--- pkgsrc/pkgtools/pkgdiff/files/patchdiff.pl 2004/01/10 05:40:40 1.6 +++ pkgsrc/pkgtools/pkgdiff/files/patchdiff.pl 2008/11/05 23:18:18 1.10 @@ -1,12 +1,12 @@ #!@PERL5@ # -# $NetBSD: patchdiff.pl,v 1.6 2004/01/10 05:40:40 jlam Exp $ +# $NetBSD: patchdiff.pl,v 1.10 2008/11/05 23:18:18 wiz Exp $ # # patchdiff: compares a set of patches patch-aa, patch-ab, ... in # $WRKDIR/.newpatches in the with another set in patches. # # Copyright (c) 2000 by Dieter Baron and -# Thomas Klausner +# Thomas Klausner # All Rights Reserved. Absolutely no warranty. use Getopt::Std; @@ -27,6 +27,7 @@ sub getfilename { close(handle); $_ = $1; chomp(); + s/^\.\///; # ignore leading "./", if any. return $_; } close(handle); @@ -95,8 +96,23 @@ foreach $patch (keys%new) { if (defined($orig{$patch})) { # system("diff",$orig{$patch},$new{$patch}); $diff=`diff $orig{$patch} $new{$patch}`; - $diff=~s/^\dc\d\n..\$NetBSD.*\$\n---\n..\$NetBSD.*\$\n//m; - $diff=~s/^\dc\d\n..\+\+\+.*\n---\n..\+\+\+.*\n//m; + # the following regex try to eliminate uninteresting differences + # The general structure of the diffs-to-be-removed is: + # 25c25 + # < --- something.orig 2008-08-08 08:08 + # --- + # > --- something.orig 2008-08-08 18:08 + # + # In particular, remove hunks with: + # . NetBSD RCS Id tag differences + $diff=~s/^\d+c\d+\n..\$[N]etBSD.*\$\n---\n..\$[N]etBSD.*\$\n//m; + # . only the name or date of the output file changed + $diff=~s/^\d+c\d+\n..\+\+\+.*\n---\n..\+\+\+.*\n//m; + # . only the name or date of the input file changed + $diff=~s/^\d+c\d+\n.\s---\s.*\.orig\s.*\n---\n.\s---\s.*\n//m; + $diff=~s/^\d+c\d+\n.\s---\s.*\n---\n.\s---\s.*\.orig\s.*\n//m; + # . only line numbers changed + $diff=~s/^\d+c\d+\n.\s@@\s.*\s@@.*\n---\n.\s@@\s.*\s@@.*\n//mg; if ($diff) { print "Comparing $orig{$patch} to $new{$patch}\n$diff"; }