summaryrefslogtreecommitdiff
path: root/pkgtools/pkgdiff
diff options
context:
space:
mode:
authordillo <dillo>2004-08-15 16:49:49 +0000
committerdillo <dillo>2004-08-15 16:49:49 +0000
commit7bc9d133a545d50900a65b862dfe7be3aebc28e5 (patch)
tree4fa793ce6cda8f03792059a03fb923c692ff5d41 /pkgtools/pkgdiff
parent9645427cd636a562504c587e9222a0b389ba30ec (diff)
downloadpkgsrc-7bc9d133a545d50900a65b862dfe7be3aebc28e5.tar.gz
mkpatches: if a patch for a file exists, give the new patch the same name
bump version to 0.114 okayed by wiz
Diffstat (limited to 'pkgtools/pkgdiff')
-rw-r--r--pkgtools/pkgdiff/Makefile4
-rwxr-xr-xpkgtools/pkgdiff/files/mkpatches.pl30
2 files changed, 28 insertions, 6 deletions
diff --git a/pkgtools/pkgdiff/Makefile b/pkgtools/pkgdiff/Makefile
index bf0002e9a65..12cd96d5660 100644
--- a/pkgtools/pkgdiff/Makefile
+++ b/pkgtools/pkgdiff/Makefile
@@ -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 --git a/pkgtools/pkgdiff/files/mkpatches.pl b/pkgtools/pkgdiff/files/mkpatches.pl
index b72342aafa5..dda53c2f435 100755
--- a/pkgtools/pkgdiff/files/mkpatches.pl
+++ b/pkgtools/pkgdiff/files/mkpatches.pl
@@ -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 Cwd;
use File::Spec;
my $patchdir;
+my $old_patchdir;
my $wrkdir;
my $l=0;
@@ -52,6 +53,9 @@ EOF
$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 @@ foreach (sort <handle>) {
$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 @@ foreach (sort <handle>) {
} 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;
+ }
+ }
}