rel 0.2.7 mit kleines Korrekturen
[gnupg.git] / scripts / mkdiff
1 #!/bin/sh
2
3 set -e
4
5 curr_ver=$(ls g10-*.tar.gz | sort -r -t '.' -n +0.4 -1 +1 -2 +2 \
6            | head -1 | sed -e 's/g10-\(.*\).tar.gz/\1/' )
7 prev_ver=$(ls g10-*.tar.gz | sort -r -t '.' -n +0.4 -1 +1 -2 +2 \
8            | head -2 | tail -1 | sed -e 's/g10-\(.*\).tar.gz/\1/' )
9
10 echo "Current  is: $curr_ver"
11 echo "Previous is: $prev_ver"
12
13 echo "Removing old directories"
14 [ -d "g10-$curr_ver" ] && rm -rf "g10-$curr_ver"
15 [ -d "g10-$prev_ver" ] && rm -rf "g10-$prev_ver"
16
17 echo "Unpacking previous and current tar"
18 tar xzf "g10-$curr_ver.tar.gz"
19 tar xzf "g10-$prev_ver.tar.gz"
20
21
22 echo "Diffing"
23 tmp_name="g10-$curr_ver.diff.tmp"
24 diff_name="g10-$curr_ver.diff"
25
26 diff -urN "g10-$prev_ver/" "g10-$curr_ver/"  > $tmp_name || true
27
28 echo "Making patch file"
29
30 cat <<EOF > $diff_name
31
32 This is a patch file against $prev_ver.
33
34 Change to directory g10-$prev_ver (or however you renamed it)
35 and give this command:
36
37      zcat somepath/g10-$curr_ver.diff.gz | patch -p1
38
39 It is a good idea to rename your current directory to g10-$curr_ver now.
40
41
42
43 Prereq: $prev_ver
44
45 EOF
46
47 sed -ne '/^diff.*VERSION/,/^+[0-9][0-9]*/ p' $tmp_name >> $diff_name
48 echo  >> $diff_name
49 sed -e '/^diff.*VERSION/,/^+[0-9][0-9]*/ d'  $tmp_name >> $diff_name
50
51 rm $tmp_name
52
53 echo "Compressing patch file"
54 gzip -9 $diff_name
55
56 echo "Checking patch file"
57 cd g10-$prev_ver
58 zcat ../$diff_name.gz | patch -s -p1
59 rm $(find . -name "*.orig")
60 cd ..
61
62 if ! diff -urN "g10-$prev_ver/" "g10-$curr_ver/" >/dev/null ; then
63    echo "compare failed"
64    exit 1
65 fi
66
67
68 echo "cleaning up"
69
70 rm -rf "g10-$curr_ver"
71 rm -rf "g10-$prev_ver"
72
73 echo "Patch file $diff_name.gz is good."
74
75
76