Tue Sep 15 08:36:07 2015 UTC ()
Handle Makefile parse errors better.

Bump version.

Requested by joerg@
Reviewed by leot@


(wiz)
diff -r1.88 -r1.89 pkgsrc/pkgtools/pkgdiff/Makefile
diff -r1.19 -r1.20 pkgsrc/pkgtools/pkgdiff/files/mkpatches.pl

cvs diff -r1.88 -r1.89 pkgsrc/pkgtools/pkgdiff/Makefile (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkgdiff/Makefile 2015/09/08 18:47:01 1.88
+++ pkgsrc/pkgtools/pkgdiff/Makefile 2015/09/15 08:36:07 1.89
@@ -1,17 +1,16 @@ @@ -1,17 +1,16 @@
1# $NetBSD: Makefile,v 1.88 2015/09/08 18:47:01 joerg Exp $ 1# $NetBSD: Makefile,v 1.89 2015/09/15 08:36:07 wiz Exp $
2 2
3PKGNAME= pkgdiff-1.6 3PKGNAME= pkgdiff-1.7
4PKGREVISION= 1 
5CATEGORIES= pkgtools devel 4CATEGORIES= pkgtools devel
6 5
7MAINTAINER= wiz@NetBSD.org 6MAINTAINER= wiz@NetBSD.org
8HOMEPAGE= ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/doc/pkgsrc.html 7HOMEPAGE= ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/doc/pkgsrc.html
9COMMENT= Tools to create, maintain, and send back patches for pkgsrc 8COMMENT= Tools to create, maintain, and send back patches for pkgsrc
10LICENSE= 2-clause-bsd AND original-bsd 9LICENSE= 2-clause-bsd AND original-bsd
11 10
12NO_CONFIGURE= yes 11NO_CONFIGURE= yes
13 12
14WRKSRC= ${WRKDIR} 13WRKSRC= ${WRKDIR}
15USE_LANGUAGES= # empty 14USE_LANGUAGES= # empty
16USE_TOOLS+= perl:run 15USE_TOOLS+= perl:run
17 16

cvs diff -r1.19 -r1.20 pkgsrc/pkgtools/pkgdiff/files/mkpatches.pl (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkgdiff/files/mkpatches.pl 2015/02/03 22:50:27 1.19
+++ pkgsrc/pkgtools/pkgdiff/files/mkpatches.pl 2015/09/15 08:36:07 1.20
@@ -1,29 +1,29 @@ @@ -1,29 +1,29 @@
1#!@PERL5@ 1#!@PERL5@
2# 2#
3# $NetBSD: mkpatches.pl,v 1.19 2015/02/03 22:50:27 abs Exp $ 3# $NetBSD: mkpatches.pl,v 1.20 2015/09/15 08:36:07 wiz Exp $
4# 4#
5# mkpatches: creates a set of patches patch-aa, patch-ab, ... 5# mkpatches: creates a set of patches patch-aa, patch-ab, ...
6# in work/.newpatches by looking for *.orig files in and below 6# in work/.newpatches by looking for *.orig files in and below
7# WRKDIR and comparing them to the corresponding changed file. All 7# WRKDIR and comparing them to the corresponding changed file. All
8# files are then referrenced relative to WRKSRC. 8# files are then referrenced relative to WRKSRC.
9# 9#
10# It should be called from the packages directory, 10# It should be called from the packages directory,
11# e.g. /usr/pkgsrc/example/test 11# e.g. /usr/pkgsrc/example/test
12# 12#
13# It retains the naming and header (RCS Id and comment) from the 13# It retains the naming and header (RCS Id and comment) from the
14# patches directory. 14# patches directory.
15# 15#
16# Copyright (c) 2000, 2011 by Thomas Klausner <wiz@NetBSD.org> 16# Copyright (c) 2000, 2011, 2015 by Thomas Klausner <wiz@NetBSD.org>
17# 2004 by Dieter Baron <dillo@NetBSD.org> 17# 2004 by Dieter Baron <dillo@NetBSD.org>
18# All rights reserved. 18# All rights reserved.
19# 19#
20# Redistribution and use in source and binary forms, with or without 20# Redistribution and use in source and binary forms, with or without
21# modification, are permitted provided that the following conditions 21# modification, are permitted provided that the following conditions
22# are met: 22# are met:
23# 1. Redistributions of source code must retain the above copyright 23# 1. Redistributions of source code must retain the above copyright
24# notice, this list of conditions and the following disclaimer. 24# notice, this list of conditions and the following disclaimer.
25# 2. Redistributions in binary form must reproduce the above copyright 25# 2. Redistributions in binary form must reproduce the above copyright
26# notice, this list of conditions and the following disclaimer in the 26# notice, this list of conditions and the following disclaimer in the
27# documentation and/or other materials provided with the distribution. 27# documentation and/or other materials provided with the distribution.
28# 28#
29# THIS SOFTWARE IS PROVIDED BY THE AUTHORS 29# THIS SOFTWARE IS PROVIDED BY THE AUTHORS
@@ -51,26 +51,38 @@ my %old_filename; @@ -51,26 +51,38 @@ my %old_filename;
51my %old_header; 51my %old_header;
52 52
53# create patchdir, or empty it if already existing 53# create patchdir, or empty it if already existing
54 54
55sub create_patchdir { 55sub create_patchdir {
56 if (! -d $patchdir) { 56 if (! -d $patchdir) {
57 mkdir($patchdir, 0755); 57 mkdir($patchdir, 0755);
58 if (-d $origpatchdir && "$origpatchdir" != "$patchdir") { 58 if (-d $origpatchdir && "$origpatchdir" != "$patchdir") {
59 system("cp", "$origpatchdir/p*", "$patchdir"); 59 system("cp", "$origpatchdir/p*", "$patchdir");
60 } 60 }
61 } 61 }
62} 62}
63 63
 64sub get_variable {
 65 my ($variable) = shift;
 66 my ($value);
 67
 68 $value = `@MAKE@ show-var VARNAME=$variable`;
 69 if (${^CHILD_ERROR_NATIVE} == 0) {
 70 chomp($value);
 71 return $value;
 72 }
 73 die("error executing \"make show-var VARNAME=$variable\": returned with exit code " . (${^CHILD_ERROR_NATIVE} >> 8));
 74}
 75
64# read command line arguments 76# read command line arguments
65 77
66undef($opt_c); 78undef($opt_c);
67undef($opt_D); 79undef($opt_D);
68undef($opt_d); 80undef($opt_d);
69undef($opt_h); 81undef($opt_h);
70undef($opt_r); 82undef($opt_r);
71undef($opt_v); 83undef($opt_v);
72undef($opt_w); 84undef($opt_w);
73 85
74getopts('cDd:hrvw'); 86getopts('cDd:hrvw');
75 87
76if ($opt_h) { 88if ($opt_h) {
@@ -85,35 +97,29 @@ usage: $prog [-hvw] [-c | -r] [-D | -d d @@ -85,35 +97,29 @@ usage: $prog [-hvw] [-c | -r] [-D | -d d
85 -v verbose - list .orig files as processed 97 -v verbose - list .orig files as processed
86 -w look for changes in \$WRKDIR instead of \$WRKSRC 98 -w look for changes in \$WRKDIR instead of \$WRKSRC
87EOF 99EOF
88 exit 0; 100 exit 0;
89}; 101};
90 102
91if ($opt_d && $opt_D) { 103if ($opt_d && $opt_D) {
92 print STDERR "-D and -d conflict, choose one\n"; 104 print STDERR "-D and -d conflict, choose one\n";
93 exit 1; 105 exit 1;
94} 106}
95 107
96# get some pkgsrc variables 108# get some pkgsrc variables
97 109
98$wrksrc=`@MAKE@ show-var VARNAME=WRKSRC` or  110$wrksrc = get_variable("WRKSRC");
99 die ("can't find WRKSRC -- wrong dir?"); 111$wrkdir = get_variable("WRKDIR");
100chomp($wrksrc); 112$origpatchdir = get_variable("PATCHDIR");
101$wrkdir=`@MAKE@ show-var VARNAME=WRKDIR` or 
102 die ("can't find WRKDIR -- wrong dir?"); 
103chomp($wrkdir); 
104$origpatchdir=`@MAKE@ show-var VARNAME=PATCHDIR` or 
105 die ("can't find PATCHDIR -- wrong dir?"); 
106chomp($origpatchdir); 
107 113
108if ($opt_D) { 114if ($opt_D) {
109 $patchdir = "$wrkdir/.newpatches"; 115 $patchdir = "$wrkdir/.newpatches";
110} elsif ($opt_d) { 116} elsif ($opt_d) {
111 if (-d "/$opt_d") { 117 if (-d "/$opt_d") {
112 $patchdir = $opt_d; 118 $patchdir = $opt_d;
113 } else { 119 } else {
114 my $pwd = cwd(); 120 my $pwd = cwd();
115 chomp($pwd); 121 chomp($pwd);
116 $patchdir = "$pwd/$opt_d"; 122 $patchdir = "$pwd/$opt_d";
117 } 123 }
118} else { 124} else {
119 $patchdir = $origpatchdir; 125 $patchdir = $origpatchdir;