aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--README6
-rwxr-xr-xpkgdiffs4
-rwxr-xr-xpkgpatch13
-rw-r--r--usr/pkgsrc/pkgtools/pkgdiff/files/patch-t191
5 files changed, 17 insertions, 199 deletions
diff --git a/Makefile b/Makefile
index de49dcc..b70a1bd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,2 +1,2 @@
install:
- install conv pkgdiffs undopatch /usr/local/bin
+ install conv pkgdiffs pkgpatch undopatch /usr/local/bin
diff --git a/README b/README
index 1c5258d..f8097a8 100644
--- a/README
+++ b/README
@@ -77,8 +77,4 @@ The usr/ directory contains patches for the NetBSD distribution.
== Applying a patch ==
cd /usr/*src/...
- patch -F3 -Vt <~/patches/usr/*src/.../patch-name
-
--F3 increases the fuzz from the default value of 2. -Vt enables
-numbered backups, which avoids overwriting original files when
-applying multiple patches.
+ pkgpatch <~/patches/usr/*src/.../patch-name
diff --git a/pkgdiffs b/pkgdiffs
index a2743cd..e39d5a0 100755
--- a/pkgdiffs
+++ b/pkgdiffs
@@ -2,9 +2,9 @@
# pkgdiffs -- concatenate pkgdiffs
-[ x"$1" = "-a" ] || pkgdiff "${1%.~1~}"
+[ x"$1" = "-a" ] || pkgdiff "${1%.orig}"
shift
for f in "$@"; do
- pkgdiff "${f%.~1~}" | sed -n '2,$p'
+ pkgdiff "${f%.orig}" | sed -n '2,$p'
done
diff --git a/pkgpatch b/pkgpatch
new file mode 100755
index 0000000..8d68c20
--- /dev/null
+++ b/pkgpatch
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# pkgpatch -- patch but don't overwrite original files
+
+for orig in *.orig; do
+ mv -i "$orig" "${orig%.orig}".~1~
+done
+
+patch -Vt -F3 "$@"
+
+for orig in *.~1~; do
+ mv -i "$orig" "${orig%.~1~}".orig
+done
diff --git a/usr/pkgsrc/pkgtools/pkgdiff/files/patch-t b/usr/pkgsrc/pkgtools/pkgdiff/files/patch-t
deleted file mode 100644
index c91c106..0000000
--- a/usr/pkgsrc/pkgtools/pkgdiff/files/patch-t
+++ /dev/null
@@ -1,191 +0,0 @@
-$NetBSD$
-
-Use .~1~ extension instead of .orig (like patch -Vt).
-
---- feedback-patches.orig 2011-02-02 21:44:13.000000000 +0000
-+++ feedback-patches
-@@ -51,7 +51,7 @@ fi
- pkg=`echo $pkg_f | sed -e 's,.*/pkgsrc/,,' -e 's,/$,,'`
- cd $PKGSRCBASE/$pkg
-
--if [ ! -d patches -o `ls patches 2>/dev/null | grep -v orig | grep -v BAK | wc -l` -eq 0 ]
-+if [ ! -d patches -o `ls patches 2>/dev/null | grep -v ~1~ | grep -v BAK | wc -l` -eq 0 ]
- then
- echo '***' Package $pkg has no patches, exiting.
- exit 0
-
---- mkpatches.pl.orig 2019-08-21 13:00:06.000000000 +0000
-+++ mkpatches.pl
-@@ -4,5 +4,5 @@
- #
- # mkpatches: creates a set of patches patch-aa, patch-ab, ...
--# in work/.newpatches by looking for *.orig files in and below
-+# in work/.newpatches by looking for *.~1~ files in and below
- # WRKDIR and comparing them to the corresponding changed file. All
- # files are then referrenced relative to WRKSRC.
-@@ -100,5 +100,5 @@ usage: $prog [-hvw] [-c | -r] [-D | -d d
- -h show this help
- -r revert -- remove new patches, put old patches back
-- -v verbose - list .orig files as processed
-+ -v verbose - list .~1~ files as processed
- -w look for changes in \$WRKDIR instead of \$WRKSRC
- EOF
-@@ -133,5 +133,5 @@ if ($opt_D) {
-
- if ($opt_c) {
-- open(HANDLE, "find ${patchdir} -type f -name \\\*.orig |");
-+ open(HANDLE, "find ${patchdir} -type f -name \\\*.~1~ |");
- foreach (<HANDLE>) {
- chomp;
-@@ -142,10 +142,10 @@ if ($opt_c) {
-
- if ($opt_r) {
-- open(HANDLE, "find ${patchdir} -type f -name \\\*.orig |");
-+ open(HANDLE, "find ${patchdir} -type f -name \\\*.~1~ |");
- foreach (<HANDLE>) {
- chomp;
- my $orig = $_;
- my $new = $_;
-- $new =~ s/.orig$//;
-+ $new =~ s/.~1~$//;
- rename $orig, $new;
- if (! -s $new) {
-@@ -167,7 +167,7 @@ chdir $wrksrc or die ("can't cd to WRKSR
-
- if ($opt_w) {
-- open(HANDLE, "find ${wrkdir} -type f -name \\\*.orig |");
-+ open(HANDLE, "find ${wrkdir} -type f -name \\\*.~1~ |");
- } else {
-- open(HANDLE, "find ${wrksrc} -type f -name \\\*.orig |");
-+ open(HANDLE, "find ${wrksrc} -type f -name \\\*.~1~ |");
- }
-
-@@ -181,5 +181,5 @@ foreach (sort <HANDLE>) {
- $path = $_;
- $complete = $path;
-- $complete =~ s/.orig$//;
-+ $complete =~ s/.~1~$//;
- $new = File::Spec->abs2rel($complete, $wrksrc);
- $old = File::Spec->abs2rel($path, $wrksrc);
-@@ -214,7 +214,7 @@ sub analyze_old_patches
- while ($origfilename = <HANDLE>) {
- chomp $origfilename;
-- next if not $origfilename =~ m/.orig$/;
-+ next if not $origfilename =~ m/.~1~$/;
- $filename = $origfilename;
-- $filename =~ s/.orig$//;
-+ $filename =~ s/.~1~$//;
- $checkname = $origfilename;
- if (! -s $checkname) {
-@@ -245,7 +245,7 @@ sub move_away_old_patches
- while ($filename = <HANDLE>) {
- chomp $filename;
-- next if $filename =~ m/.orig$/;
-- if (-f "$filename" and not -f "$filename.orig") {
-- rename "$filename", "$filename.orig";
-+ next if $filename =~ m/.~1~$/;
-+ if (-f "$filename" and not -f "$filename.~1~") {
-+ rename "$filename", "$filename.~1~";
- }
- }
-@@ -276,10 +276,10 @@ sub make_patch # new old patchfile diff
- if ("$diff" eq "") {
- print "$old and $new don't differ\n";
-- if (-f "$patchdir/$patchfile.orig") {
-- rename "$patchdir/$patchfile.orig", "$patchdir/$patchfile";
-+ if (-f "$patchdir/$patchfile.~1~") {
-+ rename "$patchdir/$patchfile.~1~", "$patchdir/$patchfile";
- }
- }
-- if (not -f "$patchdir/$patchfile.orig") {
-- system("touch", "$patchdir/$patchfile.orig");
-+ if (not -f "$patchdir/$patchfile.~1~") {
-+ system("touch", "$patchdir/$patchfile.~1~");
- }
- if (defined($old_header{$new})) {
-@@ -294,12 +294,12 @@ sub make_patch # new old patchfile diff
- # check if the new patch is basically the same as the old one
-
-- $diff=`diff $patchdir/$patchfile.orig $patchdir/$patchfile`;
-+ $diff=`diff $patchdir/$patchfile.~1~ $patchdir/$patchfile`;
-
- # the following regex try to eliminate uninteresting differences
- # The general structure of the diffs-to-be-removed is:
- # 25c25
-- # < --- something.orig 2008-08-08 08:08
-+ # < --- something.~1~ 2008-08-08 08:08
- # ---
-- # > --- something.orig 2008-08-08 18:08
-+ # > --- something.~1~ 2008-08-08 18:08
- #
- # In particular, remove hunks with:
-@@ -320,5 +320,5 @@ sub make_patch # new old patchfile diff
- } else {
- # restore previous version to get rid of uninteresting diffs
-- rename "$patchdir/$patchfile.orig", "$patchdir/$patchfile";
-+ rename "$patchdir/$patchfile.~1~", "$patchdir/$patchfile";
- }
-
-
---- patchdiff.pl.orig 2016-02-10 16:00:10.000000000 +0000
-+++ patchdiff.pl
-@@ -110,13 +110,13 @@ if ( ! -d $patchdir) {
- exit(0);
- }
-
--open(HANDLE, "find ${patchdir} -type f -name \\\*.orig |");
-+open(HANDLE, "find ${patchdir} -type f -name \\\*.~1~ |");
-
- foreach (sort <HANDLE>) {
- $orig = $_;
- chomp($orig);
- $new = $orig;
-- $new =~ s/.orig$//;
-+ $new =~ s/.~1~$//;
-
- if (! -f "$new") {
- print "File $new removed\n";
-
---- pkgdiff.orig 2015-02-03 22:50:27.000000000 +0000
-+++ pkgdiff
-@@ -7,7 +7,7 @@
- #
- # Will output a patch ready for the NetBSD Pkgs Collection (unified
- # diff, plus no RCS IDs if possible). If only newfile is given,
--# oldfile is assumed as newfile.orig.
-+# oldfile is assumed as newfile.~1~.
- #
-
- #
-@@ -70,8 +70,8 @@ export TZ=UTC
-
- if [ $# -le 1 ]
- then
-- if [ -f "$1.orig" ]; then
-- old="$1.orig"
-+ if [ -f "$1.~1~" ]; then
-+ old="$1.~1~"
- new="$1"
- else
- echo $0: need at least one argument >&2
-
---- pkgvi.orig 2011-08-23 21:47:18.000000000 +0000
-+++ pkgvi
-@@ -59,7 +59,7 @@ then
- exit 2
- fi
-
--if [ -f "$file.orig" ]
-+if [ -f "$file.~1~" ]
- then
- chmod u+w "$file"
- $editor $cmd "$file"
-@@ -93,7 +93,7 @@ if cmp "$file" "$tmp" >/dev/null 2>&1
- then
- echo "$progname: File unchanged."
- else
-- mv "$file" "$file.orig"
-+ mv "$file" "$file.~1~"
- mv "$tmp" "$file"
- echo "$progname: File was modified. For a diff, type:"
- echo "pkgdiff \"$file\""