diff options
author | wiz <wiz> | 2016-02-10 16:00:10 +0000 |
---|---|---|
committer | wiz <wiz> | 2016-02-10 16:00:10 +0000 |
commit | d40ae6b4467d0fd1827ff9ac360d5bb0d9ce140c (patch) | |
tree | 7ff1eba971036c21a749d64af74fb8a9f31ff2b9 /pkgtools | |
parent | d7f021a75bd9abec74307db64fb999118e9d9155 (diff) | |
download | pkgsrc-d40ae6b4467d0fd1827ff9ac360d5bb0d9ce140c.tar.gz |
pkgdiff: move automatic cleanup of unnecessary patches from patchdiff(1)
to mkpatches(1).
Requested by jperkin.
Update man pages.
Bump version.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkgdiff/Makefile | 4 | ||||
-rw-r--r-- | pkgtools/pkgdiff/files/mkpatches.1 | 9 | ||||
-rwxr-xr-x | pkgtools/pkgdiff/files/mkpatches.pl | 36 | ||||
-rw-r--r-- | pkgtools/pkgdiff/files/patchdiff.1 | 7 | ||||
-rwxr-xr-x | pkgtools/pkgdiff/files/patchdiff.pl | 25 |
5 files changed, 48 insertions, 33 deletions
diff --git a/pkgtools/pkgdiff/Makefile b/pkgtools/pkgdiff/Makefile index e4f0350e05c..837a21cac63 100644 --- a/pkgtools/pkgdiff/Makefile +++ b/pkgtools/pkgdiff/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.89 2015/09/15 08:36:07 wiz Exp $ +# $NetBSD: Makefile,v 1.90 2016/02/10 16:00:10 wiz Exp $ -PKGNAME= pkgdiff-1.7 +PKGNAME= pkgdiff-1.8 CATEGORIES= pkgtools devel MAINTAINER= wiz@NetBSD.org diff --git a/pkgtools/pkgdiff/files/mkpatches.1 b/pkgtools/pkgdiff/files/mkpatches.1 index ecfe246685a..15a2719f9e2 100644 --- a/pkgtools/pkgdiff/files/mkpatches.1 +++ b/pkgtools/pkgdiff/files/mkpatches.1 @@ -1,6 +1,6 @@ -.\" $NetBSD: mkpatches.1,v 1.8 2011/06/26 12:11:39 wiz Exp $ +.\" $NetBSD: mkpatches.1,v 1.9 2016/02/10 16:00:10 wiz Exp $ .\" -.\" Copyright (c) 2000-2011 by Thomas Klausner <wiz@NetBSD.org> +.\" Copyright (c) 2000-2016 by Thomas Klausner <wiz@NetBSD.org> .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -24,7 +24,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd June 26, 2011 +.Dd February 10, 2016 .Dt MKPATCHES 1 .Os .Sh NAME @@ -62,6 +62,9 @@ and can be easily compared to the currently existing set using or .Ic "cvs diff" . .Pp +If the new patch differs from an existing patch only due to line +numbers or RCS Ids, the old patch will be kept unchanged. +.Pp Supported options are: .Bl -tag -width 3n .It Fl c diff --git a/pkgtools/pkgdiff/files/mkpatches.pl b/pkgtools/pkgdiff/files/mkpatches.pl index c538c20fd97..8a4524dba4d 100755 --- a/pkgtools/pkgdiff/files/mkpatches.pl +++ b/pkgtools/pkgdiff/files/mkpatches.pl @@ -1,6 +1,6 @@ #!@PERL5@ # -# $NetBSD: mkpatches.pl,v 1.20 2015/09/15 08:36:07 wiz Exp $ +# $NetBSD: mkpatches.pl,v 1.21 2016/02/10 16:00:10 wiz Exp $ # # mkpatches: creates a set of patches patch-aa, patch-ab, ... # in work/.newpatches by looking for *.orig files in and below @@ -13,7 +13,7 @@ # It retains the naming and header (RCS Id and comment) from the # patches directory. # -# Copyright (c) 2000, 2011, 2015 by Thomas Klausner <wiz@NetBSD.org> +# Copyright (c) 2000, 2011, 2015, 2016 by Thomas Klausner <wiz@NetBSD.org> # 2004 by Dieter Baron <dillo@NetBSD.org> # All rights reserved. # @@ -281,4 +281,36 @@ sub make_patch # new old patchfile diff open(HANDLE, "> $patchdir/$patchfile"); print HANDLE $diff; close(HANDLE); + + # check if the new patch is basically the same as the old one + + $diff=`diff $patchdir/$patchfile.orig $patchdir/$patchfile`; + + # 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) { + # all fine, keep diff + } else { + # restore previous version to get rid of uninteresting diffs + rename "$patchdir/$patchfile.orig", "$patchdir/$patchfile"; + } + } diff --git a/pkgtools/pkgdiff/files/patchdiff.1 b/pkgtools/pkgdiff/files/patchdiff.1 index 3ec61cf88a4..2ee98316507 100644 --- a/pkgtools/pkgdiff/files/patchdiff.1 +++ b/pkgtools/pkgdiff/files/patchdiff.1 @@ -1,6 +1,6 @@ -.\" $NetBSD: patchdiff.1,v 1.7 2011/03/04 15:57:07 wiz Exp $ +.\" $NetBSD: patchdiff.1,v 1.8 2016/02/10 16:00:10 wiz Exp $ .\" -.\" Copyright (c) 2000-2011 by Thomas Klausner <wiz@NetBSD.org> +.\" Copyright (c) 2000-2016 by Thomas Klausner <wiz@NetBSD.org> .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -24,7 +24,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd February 20, 2011 +.Dd February 10, 2016 .Dt PATCHDIFF 1 .Os .Sh NAME @@ -48,7 +48,6 @@ directory, it is compared with its backup file .Pq Pa patch-foo.orig using .Xr diff 1 . -If no relevant differences are found, the original patch is restored. .Pp If the .Fl d diff --git a/pkgtools/pkgdiff/files/patchdiff.pl b/pkgtools/pkgdiff/files/patchdiff.pl index 64bdee637b6..33249fd7acb 100755 --- a/pkgtools/pkgdiff/files/patchdiff.pl +++ b/pkgtools/pkgdiff/files/patchdiff.pl @@ -1,11 +1,12 @@ #!@PERL5@ # -# $NetBSD: patchdiff.pl,v 1.15 2011/03/04 15:57:07 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 <dillo@giga.or.at> and # Thomas Klausner <wiz@NetBSD.org> +# Copyright (c) 2016 Thomas Klausner <wiz@NetBSD.org> # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -120,26 +121,7 @@ foreach (sort <HANDLE>) { 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"; @@ -147,8 +129,7 @@ foreach (sort <HANDLE>) { 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"; } } } |