From 568f1a179288369c6c8ba60c43756c623edeb0d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= <john@ankarstrom.se>
Date: Sat, 17 Jul 2021 22:50:41 +0200
Subject: Add usr/pkgsrc/pkgtools/pkgdiff/files/patch-t

---
 usr/pkgsrc/pkgtools/pkgdiff/files/patch-t | 191 ++++++++++++++++++++++++++++++
 1 file changed, 191 insertions(+)
 create mode 100644 usr/pkgsrc/pkgtools/pkgdiff/files/patch-t

(limited to 'usr/pkgsrc/pkgtools/pkgdiff')

diff --git a/usr/pkgsrc/pkgtools/pkgdiff/files/patch-t b/usr/pkgsrc/pkgtools/pkgdiff/files/patch-t
new file mode 100644
index 0000000..c91c106
--- /dev/null
+++ b/usr/pkgsrc/pkgtools/pkgdiff/files/patch-t
@@ -0,0 +1,191 @@
+$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\""
-- 
cgit v1.2.3