From 48a27d697505c867010c240b006e3b75fc49f293 Mon Sep 17 00:00:00 2001 From: dholland Date: Sun, 16 Sep 2012 18:09:53 +0000 Subject: Drop back to diff without -p before giving up because of rcsids appearing in the diff output. Also, improve the error message that occurs if this also fails. Fixes PR 46962. --- pkgtools/pkgdiff/Makefile | 4 ++-- pkgtools/pkgdiff/files/pkgdiff | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'pkgtools') diff --git a/pkgtools/pkgdiff/Makefile b/pkgtools/pkgdiff/Makefile index 0f1923c90cd..74e96643fcf 100644 --- a/pkgtools/pkgdiff/Makefile +++ b/pkgtools/pkgdiff/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.77 2012/09/11 23:19:38 asau Exp $ +# $NetBSD: Makefile,v 1.78 2012/09/16 18:09:53 dholland Exp $ # -DISTNAME= pkgdiff-1.3 +DISTNAME= pkgdiff-1.4 CATEGORIES= pkgtools devel MASTER_SITES= # empty DISTFILES= # empty diff --git a/pkgtools/pkgdiff/files/pkgdiff b/pkgtools/pkgdiff/files/pkgdiff index 09d28a9204e..846fa749a75 100755 --- a/pkgtools/pkgdiff/files/pkgdiff +++ b/pkgtools/pkgdiff/files/pkgdiff @@ -1,6 +1,6 @@ #!@SH@ # -# $NetBSD: pkgdiff,v 1.21 2011/02/02 23:34:48 wiz Exp $ +# $NetBSD: pkgdiff,v 1.22 2012/09/16 18:09:53 dholland Exp $ # # Usage: pkgdiff newfile # pkgdiff oldfile newfile @@ -96,14 +96,29 @@ dodiff() { esac } +dogrep() { + egrep $* '\$(NetBSD|Author|Date|Header|Id|Locker|Log|Name|RCSfile|Revision|Source|State)(:.*)?\$' +} + case x"$PKGDIFF_FMT" in x) lines=3 PKGDIFF_FMT="-p" -while [ `dodiff "$PKGDIFF_FMT" -U $lines "$old" "$new" | egrep -c '\\$(NetBSD|Author|Date|Header|Id|Locker|Log|Name|RCSfile|Revision|Source|State)(:.*)?\\$'` != 0 ] +while [ `dodiff "$PKGDIFF_FMT" -U $lines "$old" "$new" | dogrep -c` != 0 ] do lines=`expr $lines - 1` + if [ $lines = 0x -a x"$PKGDIFF_FMT" = x-p ]; then + # Try without -p instead + lines=3 + PKGDIFF_FMT="" + continue + fi if [ $lines = 0 ]; then echo "Cannot strip away RCS IDs, please handle manually!" >&2 + echo "These are the matching lines:" >&2 + dodiff "$PKGDIFF_FMT" -U $lines "$old" "$new" | dogrep |\ + sed -e 's/^/ /' >&2 + echo "Setting PKGDIFF_FMT might help." >&2 + echo "Otherwise you may need to run diff by hand." >&2 exit 1 fi done -- cgit v1.2.3