File: makepatch

package info (click to toggle)
lyx 0.12.0.final-0.1
  • links: PTS
  • area: contrib
  • in suites: hamm, slink
  • size: 9,136 kB
  • ctags: 7,588
  • sloc: cpp: 59,182; ansic: 3,977; perl: 2,994; makefile: 1,155; sh: 996; yacc: 755; tcl: 163; sed: 93
file content (101 lines) | stat: -rwxr-xr-x 1,639 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/sh

# check parameters
if [ "x$2" = x -o ! -d "$1" -o ! -d "$2" ]; then
  echo "Syntax : $0 orig-src-dir modified-src-dir [patch-dir]"
  exit 1
fi

# get parameters
ORIG_DIR=$1
MOD_DIR=$2
if [ ".$3" = "." -o ! -d "$3" ]; then
  PATCH_DIR=`pwd`
else
  PATCH_DIR=$3
fi
PATCH_NAME=`whoami`-`date +%y%m%d`.patch
INIT_DIR=`pwd`

# print startup message
echo "Creating patch :"
echo "  original dir =  $ORIG_DIR"
echo "  modified dir =  $MOD_DIR"
echo "  patch dir =     $PATCH_DIR"
echo "  patch name =    $PATCH_NAME"
echo "The patch will be gzipped and uuencoded."
echo

cd $INIT_DIR

# create diff
echo -n "Creating diff ..."
# the list of excluded files.
rm -f excl.tmp
cat >excl.tmp <<\EOF
*.orig
*.rej
*~
*.bak
*.swp
#*
*.aux
*.dvi
*.log
*.tex
Makefile
*.o
config.h
libintl.h
POTFILES
po2tbl.sed
stamp-cat-id
lyx.pot
*.gmo
cat-id-tbl.c
srcdoc
lyx
*.cache
*.status
TAGS
LaTeXConfig.lyx
textclass.lst
packages.lst
lyxrc.defaults
*CVS*
.gdb_history
core
libintl.a
EOF

# A bit of a hack, but I do not know what to do about that...
rm -f $ORIG_DIR/po/Makefile.in $MOD_DIR/po/Makefile.in

diff -p -N -r -U 4 -X excl.tmp $ORIG_DIR $MOD_DIR \
  > $PATCH_DIR/$PATCH_NAME

echo " done"
rm -f excl.tmp

# compress it
echo -n "Compressing the patch ..."
gzip -9 $PATCH_DIR/$PATCH_NAME
if [ $? -ne 0 ]; then
  echo " an error occured"
  exit 3
fi
echo " done"

# uuencode it
echo -n "Uuencoding compressed version ..."
cat $PATCH_DIR/$PATCH_NAME.gz \
  | uuencode $PATCH_NAME.gz > $PATCH_DIR/$PATCH_NAME.uue
if [ $? -ne 0 ]; then
  echo " an error occured"
  exit 4
fi
echo " done"

# print cleanup message
echo
echo "Patch has been created."