]> git.pld-linux.org Git - packages/rpm-build-macros.git/commitdiff
1.683: patchset source, added -s FILELIST support (for ncurses) auto/th/rpm-build-macros-1.683-1
authorElan Ruusamäe <glen@delfi.ee>
Fri, 3 Jan 2014 23:41:11 +0000 (01:41 +0200)
committerElan Ruusamäe <glen@delfi.ee>
Fri, 3 Jan 2014 23:41:11 +0000 (01:41 +0200)
rpm-build-macros.spec
rpm.macros

index f18d41939ee04075df8b6d25332b0f061f72ae7a..64651697be72748a4da87de1e7384e31027a2799 100644 (file)
@@ -5,7 +5,7 @@
 %if "%{pld_release}" == "ac"
 %define        with_rpm4       1
 %endif
-%define                rpm_macros_rev  1.682
+%define                rpm_macros_rev  1.683
 %define                find_lang_rev   1.36
 Summary:       PLD Linux RPM build macros
 Summary(pl.UTF-8):     Makra do budowania pakietów RPM dla Linuksa PLD
index 4df7f710706a2b2d956acb0d401903c74a2557a8..adc7cf433aa0d11aeb971069f2d177819262a349 100644 (file)
@@ -1880,24 +1880,42 @@ unset INSTALLROOT                                                                                                       \
 %{nil}
 
 # patchset macros
+# 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
+#
 # Author: Elan Ruusamäe <glen@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(f:b:) %(
-       base=%{-b*}%{!-b*:10000};
+#
+# Using sources list:
+#   %patchset_source -f <url> -s <filelist>
+#   %patchset_patch -s <filelist>
+# For example (ncurses):
+#   %patchset_source -f ftp://dickey.his.com/ncurses/%{basever}/ -s sources
+#   %patchset_patch -s sources -p1
+#
+
+%patchset_source(f:b:s:) %(
+       base=%{-b*}%{!-b*:10000}
+%{-s:
+       baseurl='%{-f*}'
+       filelist='%{-s*}'
+       i=$base
+       while read checksum file; do
+               printf "Patch%d: %s%s\\n" $i "$baseurl" "$file"
+               i=$((i+1))
+       done < $filelist
+}
+%{!-s:
        start=$(expr $base + %1);
        end=$(expr $base + %{?2}%{!?2:%{1}});
        # we need to call seq twice as it doesn't allow two formats
@@ -1905,18 +1923,31 @@ unset INSTALLROOT                                                                                                       \
        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:) %(
-       base=%{-b*}%{!-b*:10000};
+# -s filelist to read files from
+%patchset_patch(f:p:b:s:) %(
+       base=%{-b*}%{!-b*:10000}
+       patchlevel=%{-p*:-p%{-p*}}
+%{-s:
+       filelist='%{-s*}'
+       i=$base
+       while read checksum file; do
+               printf "patch%d %s\\n" $i "$patchlevel" | sed -e s,^,%%,
+               i=$((i+1))
+       done < $filelist
+}
+%{!-s:
        start=$(expr $base + %1);
        end=$(expr $base + %{?2}%{!?2:%{1}});
        echo ": patchset_patch %1%{?2: to %2}";
-       seq -f 'patch%g %{-p*:-p%{-p*}}' $start $end | sed -e s,^,%%,;
+       seq -f "patch%g $patchlevel" $start $end | sed -e s,^,%%,;
+}
 ) \
 %{nil}
 
This page took 0.171873 seconds and 4 git commands to generate.