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
|
#!/bin/sh
#
# cook - file construction tool
# Copyright (C) 1993, 1994, 1997, 2001, 2007, 2008 Peter Miller
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
case $# in
4)
project=$1
change=$2
filename=$3
path=$4
;;
*)
echo "usage: $0 <project> <change> <filename> <path>" 1>&2
exit 1
;;
esac
tmp=/tmp/$$
tmp2=/tmp/$$.2
#
# the patchlevel patch can be generated accurately
#
if test "$filename" = "common/patchlevel.h"
then
echo "Index: common/patchlevel.h"
prev=`aegis -list version -p $project -c $change | \
awk -F'"' '/previous/{print $2}'`
echo "Prereq: \"$prev\""
echo "#define PATCHLEVEL \"$prev\"" > $tmp
diff -c $tmp common/patchlevel.h | sed '1,2d'
rm -f $tmp
exit 0
fi
#
# fake patches for the generated files
#
changes=`echo $project | awk -F. '{print "etc/CHANGES."$1"."$2}'`
if test "$filename" = "$changes"
then
echo "Index: $filename"
diff -c /dev/null $path | sed '1,2d'
exit 0
fi
#
# construct a diff listing for the file
#
if aegis -cp $filename -delta 1 -output $tmp -p $project -c $change
then
in=$tmp
else
in=/dev/null
fi
if diff -c $in $path > $tmp2 2> /dev/null
then
echo $filename unchanged 1>&2
else
echo "Index: $filename"
sed '1,2d' < $tmp2
fi
#
# clean up and go home
#
rm -f $tmp $tmp2
exit 0
|