gdiff die, die, die

from Jared Yanovich
This commit is contained in:
sturm 2004-06-20 19:11:08 +00:00
parent b5b27b3216
commit 0e1d71c25e

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# $OpenBSD: update-patches,v 1.9 2003/07/30 11:10:34 jolan Exp $ # $OpenBSD: update-patches,v 1.10 2004/06/20 19:11:08 sturm Exp $
# Copyright (c) 2000 # Copyright (c) 2000
# Marc Espie. All rights reserved. # Marc Espie. All rights reserved.
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -24,13 +24,6 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE. # SUCH DAMAGE.
# Require GNU diff for now
if [ ! -x "`which gdiff`" ]; then
echo 1>&2 "Fatal: GNU diff (gdiff) is required for 'update-patches'"
echo 1>&2 " It may be installed from the textproc/gdiff port."
exit 1
fi
# Find out all $PATCHORIG files and strip the name to what diff will use # Find out all $PATCHORIG files and strip the name to what diff will use
cd $WRKDIST && find . -type f -name '*'${PATCHORIG} | fgrep -v $DISTORIG | \ cd $WRKDIST && find . -type f -name '*'${PATCHORIG} | fgrep -v $DISTORIG | \
sed -e "s,^./\(.*\)\.${PATCHORIG#.*}\$,\1," | { sed -e "s,^./\(.*\)\.${PATCHORIG#.*}\$,\1," | {
@ -61,11 +54,11 @@ do
# found it, splice before diff part with diff # found it, splice before diff part with diff
esc=`echo $file | sed -e 's,/,\\\\/,g'` esc=`echo $file | sed -e 's,/,\\\\/,g'`
{ sed -e "/^--- $esc$PATCHORIG/,\$ d" <$i { sed -e "/^--- $esc$PATCHORIG/,\$ d" <$i
(cd $WRKDIST && gdiff ${DIFF_ARGS} -u -p $file$PATCHORIG $file) } >$i.new (cd $WRKDIST && diff ${DIFF_ARGS} -u -p $file$PATCHORIG $file) } >$i.new
# did it change ? mark it as changed # did it change ? mark it as changed
if gdiff ${DIFF_ARGS} -u \ if diff ${DIFF_ARGS} -u \
--ignore-matching-lines="^--- $file$PATCHORIG .*" \ -I "^--- `echo $file$PATCHORIG | sed 's/[.+]/\\\\&/g'` " \
--ignore-matching-lines="^+++ $file .*" $i $i.new 1>&2 -I "^\+\+\+ `echo $file | sed 's/[.+]/\\\\&/g'` " $i $i.new 1>&2
then then
rm $i.new rm $i.new
else else
@ -82,7 +75,7 @@ do
patchname=patch-`echo $file|sed -e s,[/.],_,g` patchname=patch-`echo $file|sed -e s,[/.],_,g`
echo 1>&2 "No patch-* found for $file, creating $patchname" echo 1>&2 "No patch-* found for $file, creating $patchname"
{ echo "$"OpenBSD$; \ { echo "$"OpenBSD$; \
(cd $WRKDIST && gdiff ${DIFF_ARGS} -u -p $file$PATCHORIG $file) }>$patchname (cd $WRKDIST && diff ${DIFF_ARGS} -u -p $file$PATCHORIG $file) }>$patchname
edit="$edit $patchname" edit="$edit $patchname"
accounted="$accounted $patchname" accounted="$accounted $patchname"
done done
@ -109,7 +102,7 @@ do
esac esac
done done
# Check for $Id: update-patches,v 1.9 2003/07/30 11:10:34 jolan Exp $ and similar bugs in all those patch files. # Check for $Id: update-patches,v 1.10 2004/06/20 19:11:08 sturm Exp $ and similar bugs in all those patch files.
for i in $accounted for i in $accounted
do do
if sed -e '/1,^---/ d' $i|grep '$(Id|OpenBSD' if sed -e '/1,^---/ d' $i|grep '$(Id|OpenBSD'