diff options
author | hauke <hauke@pkgsrc.org> | 2019-08-21 13:00:06 +0000 |
---|---|---|
committer | hauke <hauke@pkgsrc.org> | 2019-08-21 13:00:06 +0000 |
commit | 224ee3493faa8fabcb022daeae467122498299df (patch) | |
tree | 440c4f28be7188bbd1760073160ffee03dc75832 /pkgtools | |
parent | 382fed19c3e1f2c728d31fb5f5038e7351c34c23 (diff) | |
download | pkgsrc-224ee3493faa8fabcb022daeae467122498299df.tar.gz |
Properly preserve patch comments when working with a readonly pkgsrc tree.
Do not prefix an absolute path argument with $cwd.
Declare a handful of variables, and 'use warnings'.
Fixes PR pkg/54485
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkgdiff/Makefile | 4 | ||||
-rwxr-xr-x | pkgtools/pkgdiff/files/mkpatches.pl | 19 |
2 files changed, 16 insertions, 7 deletions
diff --git a/pkgtools/pkgdiff/Makefile b/pkgtools/pkgdiff/Makefile index 5e9838f0d98..4ef7c6b57ca 100644 --- a/pkgtools/pkgdiff/Makefile +++ b/pkgtools/pkgdiff/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.94 2019/08/11 13:22:36 wiz Exp $ +# $NetBSD: Makefile,v 1.95 2019/08/21 13:00:06 hauke Exp $ PKGNAME= pkgdiff-1.8 -PKGREVISION= 4 +PKGREVISION= 5 CATEGORIES= pkgtools devel MAINTAINER= wiz@NetBSD.org diff --git a/pkgtools/pkgdiff/files/mkpatches.pl b/pkgtools/pkgdiff/files/mkpatches.pl index 8a4524dba4d..bf8cb314540 100755 --- a/pkgtools/pkgdiff/files/mkpatches.pl +++ b/pkgtools/pkgdiff/files/mkpatches.pl @@ -1,6 +1,6 @@ #!@PERL5@ # -# $NetBSD: mkpatches.pl,v 1.21 2016/02/10 16:00:10 wiz Exp $ +# $NetBSD: mkpatches.pl,v 1.22 2019/08/21 13:00:06 hauke Exp $ # # mkpatches: creates a set of patches patch-aa, patch-ab, ... # in work/.newpatches by looking for *.orig files in and below @@ -39,24 +39,29 @@ # POSSIBILITY OF SUCH DAMAGE. # +use warnings; + use Getopt::Std; use Cwd; use File::Spec; +my $prog; +my $patchfile; my $patchdir; +my $origpatchdir; my $old_patchdir; my $wrkdir; my $wrksrc; my %old_filename; my %old_header; -# create patchdir, or empty it if already existing +# create patchdir, and populate with existing patches sub create_patchdir { if (! -d $patchdir) { mkdir($patchdir, 0755); - if (-d $origpatchdir && "$origpatchdir" != "$patchdir") { - system("cp", "$origpatchdir/p*", "$patchdir"); + if (-d $origpatchdir && "$origpatchdir" ne "$patchdir") { + system("cp $origpatchdir/p* $patchdir"); } } } @@ -114,7 +119,8 @@ $origpatchdir = get_variable("PATCHDIR"); if ($opt_D) { $patchdir = "$wrkdir/.newpatches"; } elsif ($opt_d) { - if (-d "/$opt_d") { + if ($opt_d =~ /^\//) { + # Do not prefix an absolute path $patchdir = $opt_d; } else { my $pwd = cwd(); @@ -168,6 +174,7 @@ if ($opt_w) { # create patches foreach (sort <HANDLE>) { + my $diff; my ($path, $complete); my ($new, $old); chomp(); @@ -231,6 +238,8 @@ sub analyze_old_patches sub move_away_old_patches { + my $filename; + open(HANDLE, "ls $patchdir/patch-* 2>/dev/null |"); while ($filename = <HANDLE>) { |