SOURCES: rpm.macros - macros for using sequental patches (f.e: vim)

glen glen at pld-linux.org
Fri Dec 22 20:18:19 CET 2006


Author: glen                         Date: Fri Dec 22 19:18:19 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- macros for using sequental patches (f.e: vim)

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

---- Diffs:

================================================================
Index: SOURCES/rpm.macros
diff -u SOURCES/rpm.macros:1.349 SOURCES/rpm.macros:1.350
--- SOURCES/rpm.macros:1.349	Wed Dec 20 12:11:22 2006
+++ SOURCES/rpm.macros	Fri Dec 22 20:18:14 2006
@@ -1272,4 +1272,39 @@
 done																\
 %{nil}
 
+# patchset macros
+# Author: Elan Ruusamäe <glen at pld-linux.org>
+#
+# Usage:
+#   %patchset_source -f <seq(1) format> <start> [<end>]
+#   %patchset_patch <start> [<end>]
+#
+# If <end> is omited, it is assumed to be <start>.
+#
+# For example in preamble:
+#  %patchset_source -f ftp://ftp.vim.org/pub/editors/vim/patches/7.0/7.0.%03g 33 44
+# and in %prep:
+#  %patchset_patch 33 44
+
+# 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; \
+	seq -f '%{-f*}' %1 %{?2}%{!?2:%{1}} > %{tmpdir}/__ps2; \
+	paste %{tmpdir}/__ps{1,2}; \
+	rm -f %{tmpdir}/__ps{1,2}; \
+) \
+%{nil}
+
+# apply sources from %patchset_source
+# -p specify -pX for %patch line
+# -b base offset: defaults to 10000
+%patchset_patch(f:p:b:) %(
+	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)}'; \
+) \
+%{nil}
+
 # vim:ts=4 sw=4 noet syn=spec
================================================================

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



More information about the pld-cvs-commit mailing list