pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkgdiff mkpatches: if a patch for a file exis...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/073a1717193d
branches:  trunk
changeset: 479490:073a1717193d
user:      dillo <dillo%pkgsrc.org@localhost>
date:      Sun Aug 15 16:49:49 2004 +0000

description:
mkpatches: if a patch for a file exists, give the new patch the same name
bump version to 0.114
okayed by wiz

diffstat:

 pkgtools/pkgdiff/Makefile           |   4 ++--
 pkgtools/pkgdiff/files/mkpatches.pl |  30 ++++++++++++++++++++++++++----
 2 files changed, 28 insertions(+), 6 deletions(-)

diffs (78 lines):

diff -r a6a437994341 -r 073a1717193d pkgtools/pkgdiff/Makefile
--- a/pkgtools/pkgdiff/Makefile Sun Aug 15 15:17:07 2004 +0000
+++ b/pkgtools/pkgdiff/Makefile Sun Aug 15 16:49:49 2004 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.48 2004/04/11 21:35:21 jschauma Exp $
+# $NetBSD: Makefile,v 1.49 2004/08/15 16:49:49 dillo Exp $
 #
 
-DISTNAME=      pkgdiff-0.113
+DISTNAME=      pkgdiff-0.114
 CATEGORIES=    pkgtools devel
 MASTER_SITES=  # empty
 DISTFILES=     # empty
diff -r a6a437994341 -r 073a1717193d pkgtools/pkgdiff/files/mkpatches.pl
--- a/pkgtools/pkgdiff/files/mkpatches.pl       Sun Aug 15 15:17:07 2004 +0000
+++ b/pkgtools/pkgdiff/files/mkpatches.pl       Sun Aug 15 16:49:49 2004 +0000
@@ -1,6 +1,6 @@
 #!@PERL5@
 #
-# $NetBSD: mkpatches.pl,v 1.9 2004/01/10 05:40:40 jlam Exp $
+# $NetBSD: mkpatches.pl,v 1.10 2004/08/15 16:49:49 dillo Exp $
 #
 # mkpatches: creates a set of patches patch-aa, patch-ab, ...
 #   in work/.newpatches by looking for *.orig files in and below
@@ -19,6 +19,7 @@
 use File::Spec;
 
 my $patchdir;
+my $old_patchdir;
 my $wrkdir;
 my $l=0;
 
@@ -52,6 +53,9 @@
 $wrkdir=`@MAKE@ show-var VARNAME=WRKDIR` or
     die ("can't find WRKDIR -- wrong dir?");
 chomp($wrkdir);
+$old_patchdir=`@MAKE@ show-var VARNAME=PATCHDIR` or
+    die ("can't find PATCHDIR -- wrong dir?");
+chomp($old_patchdir);
 
 if ($opt_d) {
     $patchdir = cwd()."/$opt_d";
@@ -86,8 +90,7 @@
     $new = File::Spec->abs2rel( $complete, $wrksrc );
     $old = File::Spec->abs2rel( $path, $wrksrc );
     if ( -f $complete ) {
-       $patchfile = ("aa".."zz")[$l];
-       $patchfile =~ s/^/patch-/;
+       $patchfile = patch_name($new);
        if ($opt_v) {
            print "$patchfile -> $complete\n";
        }
@@ -103,5 +106,24 @@
     } else {
        print ("$new doesn't exist, though $old does\n");
     }
-    $l++;
 }
+
+sub patch_name # filename
+{
+    my $name = shift;
+    my $pname, $l;
+
+    $pname = `grep -l -- '^\+\+\+ $name\$' $old_patchdir/patch-*`;
+    chomp($pname);
+    if ($pname) {
+       $pname =~ s!.*/!!;
+       return $pname;
+    }
+
+    for ($l=0; ; $l++) {
+       $pname = 'patch-' . ("aa" .. "zz")[$l];
+       if (! -f "$old_patchdir/$pname" and ! -f "$patchdir/$pname") {
+           return $pname;
+       }
+    }
+}



Home | Main Index | Thread Index | Old Index