pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkgdiff Properly preserve patch comments when...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d9d4a344edea
branches:  trunk
changeset: 400060:d9d4a344edea
user:      hauke <hauke%pkgsrc.org@localhost>
date:      Wed Aug 21 13:00:06 2019 +0000

description:
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:

 pkgtools/pkgdiff/Makefile           |   4 ++--
 pkgtools/pkgdiff/files/mkpatches.pl |  19 ++++++++++++++-----
 2 files changed, 16 insertions(+), 7 deletions(-)

diffs (84 lines):

diff -r b5419f706f8d -r d9d4a344edea pkgtools/pkgdiff/Makefile
--- a/pkgtools/pkgdiff/Makefile Wed Aug 21 12:59:54 2019 +0000
+++ b/pkgtools/pkgdiff/Makefile Wed Aug 21 13:00:06 2019 +0000
@@ -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@localhost
diff -r b5419f706f8d -r d9d4a344edea pkgtools/pkgdiff/files/mkpatches.pl
--- a/pkgtools/pkgdiff/files/mkpatches.pl       Wed Aug 21 12:59:54 2019 +0000
+++ b/pkgtools/pkgdiff/files/mkpatches.pl       Wed Aug 21 13:00:06 2019 +0000
@@ -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 @@
 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 @@
 # create patches
 
 foreach (sort <HANDLE>) {
+    my $diff;
     my ($path, $complete);
     my ($new, $old);
     chomp();
@@ -231,6 +238,8 @@
 
 sub move_away_old_patches
 {
+    my $filename;
+
     open(HANDLE, "ls $patchdir/patch-* 2>/dev/null |");
 
     while ($filename = <HANDLE>) {



Home | Main Index | Thread Index | Old Index