60 lines
1.4 KiB
Text
Executable file
60 lines
1.4 KiB
Text
Executable file
#!@SH@
|
|
#
|
|
# $NetBSD: pkgdiff,v 1.14 2004/05/23 21:55:47 danw Exp $
|
|
#
|
|
# Usage: pkgdiff newfile
|
|
# pkgdiff oldfile newfile
|
|
#
|
|
# Will output a patch ready for the NetBSD Pkgs Collection (unified
|
|
# diff, plus no RCS IDs if possible). If only newfile is given,
|
|
# oldfile is assumed as newfile.orig.
|
|
#
|
|
# Copyright (c) 2000 by Hubert Feyrer <hubertf@netbsd.org>
|
|
# All Rights Reserved. Absolutely no warranty.
|
|
#
|
|
|
|
if [ $# -le 1 ]
|
|
then
|
|
if [ -f "$1.orig" ]; then
|
|
old="$1.orig"
|
|
new="$1"
|
|
else
|
|
echo $0: need at least one argument >&2
|
|
exit 1;
|
|
fi
|
|
else
|
|
old="$1"
|
|
new="$2"
|
|
fi
|
|
|
|
dodiff() {
|
|
case x"`basename $new`" in
|
|
xconfigure)
|
|
@DIFF@ -I '\(echo .*as_me:[0-9][0-9]*:\|echo .*configure:[0-9][0-9]*:\|line [0-9][0-9]* "configure\)' $*
|
|
;;
|
|
*)
|
|
@DIFF@ $*
|
|
esac
|
|
}
|
|
|
|
lines=3
|
|
: ${PKGDIFF_FMT:=-u -p}
|
|
while [ `dodiff "$PKGDIFF_FMT" -$lines "$old" "$new" | egrep -c '\\$(NetBSD|Author|Date|Header|Id|Locker|Log|Name|RCSfile|Revision|Source|State)(:.*)?\\$'` != 0 ]
|
|
do
|
|
lines=`expr $lines - 1`
|
|
if [ $lines = 0 ]; then
|
|
echo "Cannot strip away RCS IDs, please handle manually!" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
if dodiff -q "$PKGDIFF_FMT" -$lines "$old" "$new" > /dev/null
|
|
then
|
|
:
|
|
else
|
|
echo '$'NetBSD'$'
|
|
echo ''
|
|
# Strip out the date on the +++ line to reduce needless
|
|
# differences in regenerated patches
|
|
dodiff "$PKGDIFF_FMT" -$lines "$old" "$new" | sed -e 's:^\(+++ [^ ]*\) .*:\1:'
|
|
fi
|