SOURCES: rpm.macros - allow -b (base in %patchset_source), somewha...

glen glen at pld-linux.org
Fri Dec 22 20:28:36 CET 2006


Author: glen                         Date: Fri Dec 22 19:28:36 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- allow -b (base in %patchset_source), somewhat cleaner.

---- Files affected:
SOURCES:
   rpm.macros (1.350 -> 1.351) 

---- Diffs:

================================================================
Index: SOURCES/rpm.macros
diff -u SOURCES/rpm.macros:1.350 SOURCES/rpm.macros:1.351
--- SOURCES/rpm.macros:1.350	Fri Dec 22 20:18:14 2006
+++ SOURCES/rpm.macros	Fri Dec 22 20:28:31 2006
@@ -1289,8 +1289,12 @@
 # generate SourceX urls from range START STOP
 # Format can be SINGLE format char of %e, %f, %g, see seq(1)
 # The sources start from 10000
-%patchset_source(x:f:) %(\
-	seq -f 'Patch10%03g:' %1 %{?2}%{!?2:%{1}} > %{tmpdir}/__ps1; \
+%patchset_source(f:b:) %(\
+	base=%{-b*}%{!-b*:10000};
+	start=$((%1 + $base)); \
+	end=$((%{?2}%{!?2:%{1}} + $base)); \
+	# we need to call seq twice as it doesn't allow two formats \
+	seq -f 'Patch%g:' $start $end > %{tmpdir}/__ps1; \
 	seq -f '%{-f*}' %1 %{?2}%{!?2:%{1}} > %{tmpdir}/__ps2; \
 	paste %{tmpdir}/__ps{1,2}; \
 	rm -f %{tmpdir}/__ps{1,2}; \
@@ -1301,9 +1305,11 @@
 # -p specify -pX for %patch line
 # -b base offset: defaults to 10000
 %patchset_patch(f:p:b:) %(
+	base=%{-b*}%{!-b*:10000};
+	start=$((%1 + $base)); \
+	end=$((%{?2}%{!?2:%{1}} + $base)); \
 	echo ": patchset_patch %1%{?2: to %2}"; \
-	seq -f '%g=%{-p*:-p%{-p*}}' %1 %{?2}%{!?2:%{1}} | \
-	awk -vbase=%{-b*}%{!-b*:10000} -F= '{printf(": patchset %d\\n%%%%patch%d %s\\n", $1, $1+base, $2)}'; \
+	seq -f 'patch%g %{-p*:-p%{-p*}}' $start $end | sed -e s,^,%%,; \
 ) \
 %{nil}
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/rpm.macros?r1=1.350&r2=1.351&f=u



More information about the pld-cvs-commit mailing list