Include spec file filters directly in quilt, so that the most
popular filters can be maintained collectively.

The first spec file filter is for OBS, based on a script by Matěj
Cepl and an old SUSE-specific quilt patch.

Signed-off-by: Jean Delvare <[email protected]>
---
Changes since v1:
* Install the filter scripts in the right directory.

 Makefile.in              |    9 ++++++++-
 contrib/spec-filters/obs |    7 +++++++
 quilt/setup.in           |    8 +++++---
 3 files changed, 20 insertions(+), 4 deletions(-)

--- a/Makefile.in
+++ b/Makefile.in
@@ -117,6 +117,8 @@ DIRT +=             po/*.mo po/*~
 
 SRC +=         $(wildcard test/*.test) test/run test/test.quiltrc
 
+SPEC_FILTERS :=        $(patsubst contrib/spec-filters/%,%,$(wildcard 
contrib/spec-filters/*))
+
 NON_EXEC_IN := doc/quilt.1 doc/README quilt/scripts/patchfns 
quilt/scripts/utilfns
 
 GIT_DESC :=    $(shell ./git-desc | sed -e 's:^v::')
@@ -357,7 +359,12 @@ ifneq ($(COMPAT_PROGRAMS),)
 endif
 endif
 
-install: install-main install-compat
+install-contrib:
+       $(INSTALL) -d $(BUILD_ROOT)$(datadir)/$(PACKAGE)/spec-filters
+       $(INSTALL) -m 755 $(SPEC_FILTERS:%=contrib/spec-filters/%)      \
+                  $(BUILD_ROOT)$(datadir)/$(PACKAGE)/spec-filters
+
+install: install-main install-compat install-contrib
 
 uninstall ::
        rm -rf $(BIN:%=$(BUILD_ROOT)$(bindir)/%)                        \
--- /dev/null
+++ b/contrib/spec-filters/obs
@@ -0,0 +1,7 @@
+#!/usr/bin/sh
+# Basic spec file filter for OBS packages
+# https://build.opensuse.org/
+
+sed -e '/^%.*@BUILD_FLAVOR@/s/@BUILD_FLAVOR@//' \
+    -e '/^%lua_provides/d' \
+    -e '/^Release:/s/[<>]//g'
--- a/quilt/setup.in
+++ b/quilt/setup.in
@@ -244,10 +244,10 @@ inspect()
        # Apply filtering to the spec file if requested
        if [ -n "$spec_filter" ]
        then
-               # Make sure PATH isn't used
+               # If only a file name, read from the shared directory
                if [[ ! "$spec_filter" =~ / ]]
                then
-                       spec_filter="./$spec_filter"
+                       spec_filter="$QUILT_DIR/spec-filters/$spec_filter"
                fi
                if [ -x "$spec_filter" ]
                then
@@ -299,7 +299,9 @@ Initializes a source tree from an rpm sp
        Before passing the spec file to rpmbuild for processing, apply a
        filter to it. FILTER must be an executable script which reads the
        original spec file from stdin and writes the filtered spec file
-       to stdout.
+       to stdout. FILTER can be specified as a path to a custom script,
+       or as a simple name, in which case it references one of the
+       filter scripts shipped with quilt.
 
 --slow Use the original, slow method to process the spec file. In this mode,
        rpmbuild generates a working tree in a temporary directory while all

-- 
Jean Delvare
SUSE L3 Support

_______________________________________________
Quilt-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to