SOURCES: rpm-build.sh - easy patch -p1 maker

glen glen at pld-linux.org
Fri Mar 2 00:03:20 CET 2007


Author: glen                         Date: Thu Mar  1 23:03:20 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- easy patch -p1 maker

---- Files affected:
SOURCES:
   rpm-build.sh (1.24 -> 1.25) 

---- Diffs:

================================================================
Index: SOURCES/rpm-build.sh
diff -u SOURCES/rpm-build.sh:1.24 SOURCES/rpm-build.sh:1.25
--- SOURCES/rpm-build.sh:1.24	Thu Mar  1 23:51:37 2007
+++ SOURCES/rpm-build.sh	Fri Mar  2 00:03:15 2007
@@ -144,6 +144,19 @@
 }
 
 # does diff between FILE and FILE~
+# the diff can be applied with patch -p1
 d() {
-	dif $1{~,}
+	local file="$1"
+	local dir=${file%/*}
+	if [[ "$file" = /* ]]; then
+		# full path -- no idea where to strip
+		dir=.
+		diff=$file
+	else
+		# relative path -- keep one path component from current dir
+		dir=..
+		diff=${PWD##*/}/${file}
+	fi
+
+	(builtin cd "$dir"; dif $diff{~,})
 }
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/rpm-build.sh?r1=1.24&r2=1.25&f=u



More information about the pld-cvs-commit mailing list