From 44f733efb2e8b9c350e36106a3186c9952f53ab2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Fri, 22 Dec 2006 19:28:31 +0000 Subject: [PATCH] - allow -b (base in %patchset_source), somewhat cleaner. Changed files: rpm.macros -> 1.351 --- rpm.macros | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/rpm.macros b/rpm.macros index 7d8c137..5432c4d 100644 --- a/rpm.macros +++ b/rpm.macros @@ -1289,8 +1289,12 @@ done \ # 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 @@ done \ # -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} -- 2.44.0