- Update to version 0.69:

* Fix escaping of % and backslash in patch names
  * new: Stop claiming support of option -p ab
  * patches: Several performance optimizations
  * series: Simplify the code
  * Obsoletes fix-two-exit-values.patch
  * Obsoletes guards-fix-exit-operator-precedence-error.patch
  * Obsoletes inspect-wrapper-fix-rpm-4.20.patch
  * Obsoletes setup-implement-a-spec-filter-library.patch
  * Obsoletes setup-new-option-spec-filter.patch
  * Obsoletes setup-pass-define-to-rpmbuild-instead-of-eval-define.patch
- setup-deal-with-ExclusiveArch.patch: Make it possible to run
  "quilt setup" on a spec file which excludes the local
  architecture (boo#1238516).

OBS-URL: https://build.opensuse.org/package/show/devel:tools:scm/quilt?expand=0&rev=138
This commit is contained in:
Jean Delvare
2025-04-29 13:28:00 +00:00
committed by Git OBS Bridge
parent 6fc10e5a7d
commit c9cce0c0ed
11 changed files with 94 additions and 340 deletions

View File

@@ -1,35 +0,0 @@
From: Jean Delvare <jdelvare@suse.de>
Date: Mon, 10 Feb 2025 11:33:41 +0100
Subject: Fix two exit values
Git-commit: 8a9068f90ee08e2b8672c788363c357656cddd3e
Patch-mainline: yes
In perl, "exit" is considered a named unary operator, and these have
higher precedence than the ternary ?: opertor. Therefore parentheses
are required to properly evaluate the exit value before returning it.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
quilt/scripts/dependency-graph.in | 2 +-
test/run | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--- a/quilt/scripts/dependency-graph.in
+++ b/quilt/scripts/dependency-graph.in
@@ -112,7 +112,7 @@ SYNOPSIS: $basename [-h] [--patcher] [--
Check the ranges of lines that the patches modify for computing
dependencies. Include up to num lines of context.
EOF
- exit $help ? 0 : 1;
+ exit ($help ? 0 : 1);
}
my @nodes;
--- a/test/run
+++ b/test/run
@@ -331,4 +331,4 @@ if (isatty(fileno(STDOUT))) {
}
print_footer "$status\n";
flush_output;
-exit $failed ? 1 : 0;
+exit ($failed ? 1 : 0);

View File

@@ -1,36 +0,0 @@
From 99e4ab70434c7156a82155c68d9f753e22926d8e Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: Mon, 10 Feb 2025 11:33:37 +0100
Subject: guards: fix exit operator precedence error
Git-commit: 99e4ab70434c7156a82155c68d9f753e22926d8e
Patch-mainline: yes
The perl expression:
exit $problems ? 1 : 0;
will now throw a warning with newer versions of perl:
Possible precedence issue with control flow operator (exit) at /usr/bin/guards line 198.
as it properly catches that the control flow is NOT being evaluated
here. For more details on the issue, please see this 10-year-old perl
blog post:
https://blogs.perl.org/users/buddy_burden/2014/06/when-a-failure-is-not-a-failure.html
Fix this up by providing the proper "evaluate this expression and THEN
return the value" logic that the code was expecting:
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
bin/guards.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/bin/guards.in
+++ b/bin/guards.in
@@ -195,7 +195,7 @@ if ($check) {
# This is not an error if the entries are mutually exclusive...
}
}
- exit $problems ? 1 : 0;
+ exit ($problems ? 1 : 0);
} elsif ($list) {
parse($fh, sub {

View File

@@ -1,38 +0,0 @@
From: Jean Delvare <jdelvare@suse.de>
Subject: setup: Fix for rpm 4.20's RPM_BUILD_ROOT change
Patch-mainline: submitted 2025-03-16, https://lists.gnu.org/archive/html/quilt-dev/2025-03/msg00010.html
References: bsc#1236907
rpm 4.20 creates a working directory (named
${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION}-build) inside _builddir
and RPM_BUILD_DIR points to that directory instead of _builddir as
it used to. This confuses the inspect-wrapper script which assumes
that RPM_BUILD_DIR points to _builddir.
Detect this case and make RPM_BUILD_DIR point to _builddir again so
that the rest of the code keeps working.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
quilt/scripts/inspect-wrapper.in | 10 ++++++++++
1 file changed, 10 insertions(+)
--- quilt.orig/quilt/scripts/inspect-wrapper.in 2025-02-12 14:12:31.065020150 +0100
+++ quilt/quilt/scripts/inspect-wrapper.in 2025-02-14 13:28:37.751790147 +0100
@@ -239,6 +239,16 @@ PATH=${PATH#*:}
# If we are called too early, pass through without processing
[ -n "$RPM_BUILD_DIR" ] || exec $command "$@"
+# rpm 4.20 creates a working directory (named
+# ${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION}-build) inside _builddir
+# and RPM_BUILD_DIR points to that directory instead of _builddir as
+# it used to. Detect this case and make RPM_BUILD_DIR point to
+# _builddir again so that the rest of the code keeps working.
+if echo "$RPM_BUILD_DIR" | grep -q '/build/[^/]*-build$'
+then
+ RPM_BUILD_DIR=${RPM_BUILD_DIR%/*}
+fi
+
tmpdir=${RPM_BUILD_DIR%/*}
case $command in
patch)

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:aa4f3f1ddcdbd135bfd99df26159a1fe65a1d6b571afb5b063995184c490eaa3
size 468692

3
quilt-0.69.tar.xz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:000ec454d659d09d98e4847ec1448140ba8cc14f2f9028d1ee95ea31e7683c51
size 469476

View File

@@ -1,3 +1,21 @@
-------------------------------------------------------------------
Tue Apr 29 12:28:28 UTC 2025 - Jean Delvare <jdelvare@suse.com>
- Update to version 0.69:
* Fix escaping of % and backslash in patch names
* new: Stop claiming support of option -p ab
* patches: Several performance optimizations
* series: Simplify the code
* Obsoletes fix-two-exit-values.patch
* Obsoletes guards-fix-exit-operator-precedence-error.patch
* Obsoletes inspect-wrapper-fix-rpm-4.20.patch
* Obsoletes setup-implement-a-spec-filter-library.patch
* Obsoletes setup-new-option-spec-filter.patch
* Obsoletes setup-pass-define-to-rpmbuild-instead-of-eval-define.patch
- setup-deal-with-ExclusiveArch.patch: Make it possible to run
"quilt setup" on a spec file which excludes the local
architecture (boo#1238516).
-------------------------------------------------------------------
Mon Mar 17 15:27:54 UTC 2025 - Jean Delvare <jdelvare@suse.com>

View File

@@ -17,7 +17,7 @@
Name: quilt
Version: 0.68
Version: 0.69
Release: 0
Summary: A Tool for Working with Many Patches
License: GPL-2.0-or-later
@@ -41,12 +41,7 @@ Requires: perl
URL: http://savannah.nongnu.org/projects/quilt
Source: %{name}-%{version}.tar.xz
Source1: suse-start-quilt-mode.el
Patch1: guards-fix-exit-operator-precedence-error.patch
Patch2: fix-two-exit-values.patch
Patch3: setup-pass-define-to-rpmbuild-instead-of-eval-define.patch
Patch4: setup-new-option-spec-filter.patch
Patch5: setup-implement-a-spec-filter-library.patch
Patch6: inspect-wrapper-fix-rpm-4.20.patch
Patch1: setup-deal-with-ExclusiveArch.patch
Patch82: quilt-support-vimdiff.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch

View File

@@ -0,0 +1,71 @@
From: Jean Delvare <jdelvare@suse.de>
Subject: Let quilt setup deal with ExclusiveArch
References: boo#1238516
If the spec file includes an ExclusiveArch statement and the local
architecture isn't part of the list, rpmbuild will fail. Check for
the presence of this statement before calling rpmbuild, and if it
would fail, pass option --target to set the architecture to a
supported one.
---
quilt/setup.in | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
--- a/quilt/setup.in
+++ b/quilt/setup.in
@@ -270,6 +270,7 @@ inspect()
--define "__unzip $tmpdir/bin/unzip" \
--define "__7zip $tmpdir/bin/7z" \
"${DEFINE_FUZZ[@]}" \
+ "${FORCE_ARCH[@]}" \
--nodeps \
-bp "$specdir/$specfile" < /dev/null >&5 2>&5
status=$?
@@ -343,7 +344,36 @@ eval set -- "$options"
export QUILT_SETUP_FAST=1
prefix=
sourcedir=
-declare -a DEFINE_FUZZ
+declare -a DEFINE_FUZZ FORCE_ARCH
+
+# Sets FORCE_ARCH if needed
+check_exclusivearch()
+{
+ local spec_file=$1 our_arch a
+ local -a archs
+
+ archs=( $(sed -ne 's/^ExclusiveArch:[[:space:]]*\(.*\)$/\1/p' "$spec_file") )
+ if [ ${#archs[@]} -eq 0 ]
+ then
+ return
+ fi
+
+ # ExclusiveArch statement is present
+ our_arch=$(arch 2>/dev/null)
+ for a in "${archs[@]}"
+ do
+ if [ "$a" == "$our_arch" ]
+ then
+ # We are in the list, so no problem
+ return
+ fi
+ done
+
+ # We are not in the exclusive arch list. Force the target to the
+ # first listed architecture to make rpmbuild happy.
+
+ FORCE_ARCH=( "--target" "${archs[0]}" )
+}
while true
do
@@ -417,6 +447,9 @@ case "$1" in
# check if rpmbuild is installed before running inspect
check_external_tool rpmbuild rpm-build
+ # check if ExclusiveArch statement would block rpmbuild
+ check_exclusivearch "$spec_file"
+
if [ -n "$QUILT_SETUP_FAST" ]
then
if [ "${prefix:0:1}" = / ]

View File

@@ -1,82 +0,0 @@
From: Jean Delvare <jdelvare@suse.de>
Date: Fri, 14 Mar 2025 17:33:07 +0100
Subject: setup: Implement a spec filter library
Git-commit: 27075e81586fa1b7378caab4162ba6e8e4f45f99
Patch-mainline: yes
References: bsc#1236907
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 <jdelvare@suse.de>
---
Makefile.in | 10 +++++++++-
contrib/spec-filters/obs | 7 +++++++
quilt/setup.in | 8 +++++---
3 files changed, 21 insertions(+), 4 deletions(-)
--- a/Makefile.in
+++ b/Makefile.in
@@ -117,6 +117,9 @@ DIRT += po/*.mo po/*~
SRC += $(wildcard test/*.test) test/run test/test.quiltrc
+SPEC_FILTERS := $(patsubst contrib/spec-filters/%,%,$(wildcard contrib/spec-filters/*))
+SRC += $(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 +360,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

View File

@@ -1,80 +0,0 @@
From: Jean Delvare <jdelvare@suse.de>
Date: Fri, 14 Mar 2025 17:32:59 +0100
Subject: setup: New option --spec-filter
Git-commit: 65cda3275f16944f232fc9930fbb137a07479bc0
Patch-mainline: yes
References: bsc#1236907
Some build systems (such as OBS) don't work with compliant rpm spec
files. Instead, they use templates, which they preprocess before
passing them to rpmbuild. In order to be able to use "quilt setup"
on these spec files, we need to perform the same kind of
preprocessing.
For this purpose, introduce a new option to the setup command,
--spec-filter. This lets the user provide a customer filtering script
to preprocess their spec file before rpmbuild gets called on it.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
quilt/setup.in | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
--- a/quilt/setup.in
+++ b/quilt/setup.in
@@ -241,6 +241,23 @@ inspect()
fi
export -f normalize_path dir_to_dir
+ # Apply filtering to the spec file if requested
+ if [ -n "$spec_filter" ]
+ then
+ # Make sure PATH isn't used
+ if [[ ! "$spec_filter" =~ / ]]
+ then
+ spec_filter="./$spec_filter"
+ fi
+ if [ -x "$spec_filter" ]
+ then
+ "$spec_filter" < "$specdir/$specfile" > "$tmpdir/$specfile"
+ specdir=$tmpdir
+ else
+ printf $"Warning: can't execute filter %s\n" "$spec_filter" >&2
+ fi
+ fi
+
# let rpm do all the dirty specfile stuff ...
echo -n "### rpmbuild: " >&4
@@ -278,6 +295,12 @@ Initializes a source tree from an rpm sp
--fuzz=N
Set the maximum fuzz factor (needs rpm 4.6 or later).
+--spec-filter FILTER
+ 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.
+
--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
its actions are recorded, and then everything is replayed from scratch
@@ -306,7 +329,7 @@ and lastly applying the patches.
fi
}
-options=`getopt -o d:vh --long sourcedir:,fuzz:,slow,fast -- "$@"`
+options=`getopt -o d:vh --long sourcedir:,fuzz:,spec-filter:,slow,fast -- "$@"`
if [ $? -ne 0 ]
then
@@ -338,6 +361,9 @@ do
# Only works with rpm 4.6 and later
DEFINE_FUZZ=( "--define" "_default_patch_fuzz $2" )
shift 2 ;;
+ --spec-filter)
+ spec_filter=$2
+ shift 2 ;;
--slow)
QUILT_SETUP_FAST=
shift ;;

View File

@@ -1,59 +0,0 @@
From: Jean Delvare <jdelvare@suse.de>
Date: Fri, 14 Mar 2025 17:32:45 +0100
Subject: setup: Pass --define to rpmbuild instead of --eval "%define ..."
Git-commit: ff2210b24772bd675987930cde359a1078b89012
Patch-mainline: yes
References: bsc#1236907
Changes in rpmbuild 4.20 break defining macros using --eval "%define
..." for noarch packages. While this is a bug, it is possible and
recommended to define macros using option --define instead, so let's
just do that.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
quilt/setup.in | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
--- a/quilt/setup.in
+++ b/quilt/setup.in
@@ -245,14 +245,14 @@ inspect()
echo -n "### rpmbuild: " >&4
PATH="$tmpdir/bin:$PATH" \
- rpmbuild --eval "%define _sourcedir $abs_sourcedir" \
- --eval "%define _specdir $specdir" \
- --eval "%define _builddir $tmpdir/build" \
- --eval "%define __patch $tmpdir/bin/patch" \
- --eval "%define __tar $tmpdir/bin/tar" \
- --eval "%define __unzip $tmpdir/bin/unzip" \
- --eval "%define __7zip $tmpdir/bin/7z" \
- --eval "$DEFINE_FUZZ" \
+ rpmbuild --define "_sourcedir $abs_sourcedir" \
+ --define "_specdir $specdir" \
+ --define "_builddir $tmpdir/build" \
+ --define "__patch $tmpdir/bin/patch" \
+ --define "__tar $tmpdir/bin/tar" \
+ --define "__unzip $tmpdir/bin/unzip" \
+ --define "__7zip $tmpdir/bin/7z" \
+ "${DEFINE_FUZZ[@]}" \
--nodeps \
-bp "$specdir/$specfile" < /dev/null >&5 2>&5
status=$?
@@ -318,6 +318,7 @@ eval set -- "$options"
export QUILT_SETUP_FAST=1
prefix=
sourcedir=
+declare -a DEFINE_FUZZ
while true
do
@@ -335,7 +336,7 @@ do
shift 2 ;;
--fuzz)
# Only works with rpm 4.6 and later
- DEFINE_FUZZ="%define _default_patch_fuzz $2"
+ DEFINE_FUZZ=( "--define" "_default_patch_fuzz $2" )
shift 2 ;;
--slow)
QUILT_SETUP_FAST=