--- pkgsrc/pkgtools/pkgdiff/files/patchdiff.pl 2011/02/02 23:35:11 1.14 +++ pkgsrc/pkgtools/pkgdiff/files/patchdiff.pl 2016/02/10 16:00:10 1.16 @@ -1,11 +1,12 @@ #!@PERL5@ # -# $NetBSD: patchdiff.pl,v 1.14 2011/02/02 23:35:11 wiz Exp $ +# $NetBSD: patchdiff.pl,v 1.16 2016/02/10 16:00:10 wiz Exp $ # # patchdiff: compares a set of patches in the patch dir with their predecessors # # Copyright (c) 2000, 2011 by Dieter Baron and # Thomas Klausner +# Copyright (c) 2016 Thomas Klausner # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -69,12 +70,14 @@ sub putinhash { close(handle); } -getopts('h'); +getopts('Dd:h'); if ($opt_h) { ($prog) = ($0 =~ /([^\/]+)$/); print STDERR <) { if (! -f "$new") { print "File $new removed\n"; } else { -# system("diff",$orig{$patch},$new{$patch}); $diff=`diff $orig $new`; - # 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; - # . the name of the input file changed - # (if the name of the output file has changed, patches - # won't get matched up anyway) - # . time of the input and/or output file changed - # . line numbers changed - $diff=~s/^[\d,]+c[\d,]+\n(?:.\s---\s(:?\S+).*\n)?(?:.\s\+\+\+\s(\S+).*\n)?(?:.\s@@\s(?:.*)\s@@.*\n)?---\n(?:.\s---\s\S+.*\n)?(?:.\s\+\+\+\s\S+.*\n)?(?:.\s@@\s.*\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) { if (! -s $orig) { print "New file $new\n"; @@ -130,8 +129,7 @@ foreach (sort ) { print "Comparing $orig to $new\n$diff"; } } else { - # restore previous version to get rid of uninteresting diffs - rename "$orig", "$new"; + print "$orig and $new are the same"; } } }