1998-01-27 21:48:42 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
1999-09-02 16:50:38 +02:00
|
|
|
if [ $# != 1 ] ; then
|
|
|
|
echo "usage: mkdiff package-name" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
pack="$1"
|
|
|
|
|
1998-01-27 21:48:42 +01:00
|
|
|
set -e
|
|
|
|
|
1999-09-07 18:48:48 +02:00
|
|
|
curr_ver=$(ls $pack-*.tar.gz 2>/dev/null | sed "s/^$pack-\(.*\)\.tar\.gz/\1/"\
|
|
|
|
| sort -r -t '.' -n +0 -1 +1 -2 +2 | head -1 )
|
1999-09-02 16:50:38 +02:00
|
|
|
if [ ! -f $pack-$curr_ver.tar.gz ]; then
|
|
|
|
echo "mkdiff: no current version of package $pack found" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
1999-09-07 18:48:48 +02:00
|
|
|
prev_ver=$(ls $pack-*.tar.gz 2>/dev/null | sed "s/^$pack-\(.*\)\.tar\.gz/\1/"\
|
|
|
|
| sort -r -t '.' -n +0 -1 +1 -2 +2 | head -2 | tail -1 )
|
1999-09-02 16:50:38 +02:00
|
|
|
if [ "$prev_ver" = "$curr_ver" ]; then
|
|
|
|
echo "mkdiff: no previous version of package $pack found" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Current is: $pack-$curr_ver"
|
|
|
|
echo "Previous is: $pack-$prev_ver"
|
1998-01-27 21:48:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
echo "Removing old directories"
|
1999-09-02 16:50:38 +02:00
|
|
|
[ -d "$pack-$curr_ver" ] && rm -rf "$pack-$curr_ver"
|
|
|
|
[ -d "$pack-$prev_ver" ] && rm -rf "$pack-$prev_ver"
|
1998-02-13 21:58:50 +01:00
|
|
|
|
|
|
|
echo "Unpacking previous and current tar"
|
1999-09-02 16:50:38 +02:00
|
|
|
tar xzf "$pack-$curr_ver.tar.gz"
|
|
|
|
rm -f $pack-${curr_ver}/po/*.gmo
|
|
|
|
tar xzf "$pack-$prev_ver.tar.gz"
|
|
|
|
rm -f $pack-${prev_ver}/po/*.gmo
|
1998-01-27 21:48:42 +01:00
|
|
|
|
1998-02-13 21:58:50 +01:00
|
|
|
|
1998-01-27 21:48:42 +01:00
|
|
|
echo "Diffing"
|
1999-09-02 16:50:38 +02:00
|
|
|
tmp_name="$pack-$prev_ver-$curr_ver.diff.tmp"
|
|
|
|
diff_name="$pack-$prev_ver-$curr_ver.diff"
|
1998-01-27 21:48:42 +01:00
|
|
|
|
1999-09-02 16:50:38 +02:00
|
|
|
diff -urN "$pack-$prev_ver/" "$pack-$curr_ver/" > $tmp_name || true
|
1998-01-27 21:48:42 +01:00
|
|
|
|
|
|
|
echo "Making patch file"
|
|
|
|
|
|
|
|
cat <<EOF > $diff_name
|
|
|
|
|
1999-09-02 16:50:38 +02:00
|
|
|
This is a patch file to create version $curr_ver from $prev_ver.
|
1998-01-27 21:48:42 +01:00
|
|
|
|
1998-11-20 18:42:18 +01:00
|
|
|
Please check the signature of this patch file:
|
|
|
|
|
1999-09-02 16:50:38 +02:00
|
|
|
zcat somepath/$pack-$prev_ver-$curr_ver.diff.gz | gpg --verify
|
1998-11-20 18:42:18 +01:00
|
|
|
|
1999-09-02 16:50:38 +02:00
|
|
|
Change to directory $pack-$prev_ver (or however you renamed it)
|
1998-01-27 21:48:42 +01:00
|
|
|
and give this command:
|
|
|
|
|
1999-09-02 16:50:38 +02:00
|
|
|
zcat somepath/$pack-$prev_ver-$curr_ver.diff.gz | patch -p1
|
1998-01-27 21:48:42 +01:00
|
|
|
|
1999-09-02 16:50:38 +02:00
|
|
|
It is a good idea to rename your current directory to $pack-$curr_ver now.
|
1998-01-27 21:48:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Prereq: $prev_ver
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
sed -ne '/^diff.*VERSION/,/^+[0-9][0-9]*/ p' $tmp_name >> $diff_name
|
1998-02-13 21:58:50 +01:00
|
|
|
echo >> $diff_name
|
1998-01-27 21:48:42 +01:00
|
|
|
sed -e '/^diff.*VERSION/,/^+[0-9][0-9]*/ d' $tmp_name >> $diff_name
|
|
|
|
|
|
|
|
rm $tmp_name
|
|
|
|
|
1998-11-20 18:42:18 +01:00
|
|
|
echo "Signing and compressing patch file"
|
1999-09-02 16:50:38 +02:00
|
|
|
gpg --clearsign --not-dash-escaped -u 57548DCD \
|
1998-11-20 18:42:18 +01:00
|
|
|
< $diff_name | gzip --best > $diff_name.gz
|
1999-02-19 18:06:49 +01:00
|
|
|
rm $diff_name
|
1998-01-27 21:48:42 +01:00
|
|
|
|
|
|
|
echo "Checking patch file"
|
1999-09-02 16:50:38 +02:00
|
|
|
cd $pack-$prev_ver
|
1998-02-13 21:58:50 +01:00
|
|
|
zcat ../$diff_name.gz | patch -s -p1
|
1999-02-19 18:06:49 +01:00
|
|
|
rm $(find . -name "*.orig") 2>/dev/null || true
|
1998-01-27 21:48:42 +01:00
|
|
|
cd ..
|
|
|
|
|
1999-09-02 16:50:38 +02:00
|
|
|
if ! diff -urN "$pack-$prev_ver/" "$pack-$curr_ver/" >/dev/null ; then
|
1998-01-27 21:48:42 +01:00
|
|
|
echo "compare failed"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
1998-12-09 13:44:46 +01:00
|
|
|
if ! zcat $diff_name.gz | gpg --batch --verify ; then
|
1998-11-20 18:42:18 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
1998-01-27 21:48:42 +01:00
|
|
|
|
|
|
|
echo "cleaning up"
|
|
|
|
|
1999-09-02 16:50:38 +02:00
|
|
|
rm -rf "$pack-$curr_ver"
|
|
|
|
rm -rf "$pack-$prev_ver"
|
1998-01-27 21:48:42 +01:00
|
|
|
|
|
|
|
echo "Patch file $diff_name.gz is good."
|
|
|
|
|