SHA256
1
0
forked from pool/quilt

Accepting request 1166315 from devel:tools:scm

- Update to version 0.68.
- Drop the non-upstream "expand" command.
- Recommend unzip and zstd.

OBS-URL: https://build.opensuse.org/request/show/1166315
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/quilt?expand=0&rev=77
This commit is contained in:
Ana Guerrero 2024-04-09 14:47:55 +00:00 committed by Git OBS Bridge
commit 7e71b8b100
8 changed files with 35 additions and 572 deletions

View File

@ -1,135 +0,0 @@
From: Jean Delvare <jdelvare@suse.de>
Date: Fri, 9 Sep 2022 10:10:37 +0200
Subject: Avoid warnings with grep 3.8
Patch-mainline: yes
Git-commit: f73f8d7f71de2878d3f92881a5fcb8eafd78cb5f
References: boo#1203230
GNU grep version 3.8 became more strict about needless quoting in
patterns. We have one occurrence of that in quilt, where "/"
characters are being quoted by default. There are cases where they
indeed need to be quoted (typically when used in a sed s/// command)
but most of the time they do not, and this results in the following
warning:
grep: warning: stray \ before /
So rename quote_bre() to quote_sed_re(), and introduce
quote_grep_re() which does not quote "/".
Signed-off-by: Jean Delvare <jdelvare@suse.de>
diff --git a/quilt/diff.in b/quilt/diff.in
index e90dc33db36a..07788ffc5e75 100644
--- a/quilt/diff.in
+++ b/quilt/diff.in
@@ -255,7 +255,7 @@ then
# Add all files in the snapshot into the file list (they may all
# have changed).
files=( $(find $QUILT_PC/$snap_subdir -type f \
- | sed -e "s/^$(quote_bre $QUILT_PC/$snap_subdir/)//" \
+ | sed -e "s/^$(quote_sed_re $QUILT_PC/$snap_subdir/)//" \
| sort) )
printf "%s\n" "${files[@]}" >&4
unset files
diff --git a/quilt/patches.in b/quilt/patches.in
index bb17a463a613..eac45a9c9635 100644
--- a/quilt/patches.in
+++ b/quilt/patches.in
@@ -60,7 +60,7 @@ scan_unapplied()
# Quote each file name only once
for file in "${opt_files[@]}"
do
- files_bre[${#files_bre[@]}]=$(quote_bre "$file")
+ files_bre[${#files_bre[@]}]=$(quote_grep_re "$file")
done
# "Or" all files in a single pattern
diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in
index c2d5f9dbe946..1bd723315e2c 100644
--- a/quilt/scripts/patchfns.in
+++ b/quilt/scripts/patchfns.in
@@ -78,8 +78,14 @@ array_join()
done
}
-# Quote a string for use in a basic regular expression.
-quote_bre()
+# Quote a string for use in a regular expression for a grep pattern.
+quote_grep_re()
+{
+ echo "$1" | sed -e 's:\([][^$.*\\]\):\\\1:g'
+}
+
+# Quote a string for use in a regular expression for a sed s/// command.
+quote_sed_re()
{
echo "$1" | sed -e 's:\([][^$/.*\\]\):\\\1:g'
}
@@ -215,7 +221,7 @@ patch_in_series()
if [ -e "$SERIES" ]
then
- grep -q "^$(quote_bre $patch)\([ \t]\|$\)" "$SERIES"
+ grep -q "^$(quote_grep_re $patch)\([ \t]\|$\)" "$SERIES"
else
return 1
fi
@@ -365,7 +371,7 @@ is_applied()
{
local patch=$1
[ -e $DB ] || return 1
- grep -q "^$(quote_bre $patch)\$" $DB
+ grep -q "^$(quote_grep_re $patch)\$" $DB
}
applied_patches()
@@ -465,7 +471,7 @@ remove_from_db()
local tmpfile
if tmpfile=$(gen_tempfile)
then
- grep -v "^$(quote_bre $patch)\$" $DB > $tmpfile
+ grep -v "^$(quote_grep_re $patch)\$" $DB > $tmpfile
cat $tmpfile > $DB
rm -f $tmpfile
[ -s $DB ] || rm -f $DB
@@ -520,7 +526,7 @@ find_patch()
fi
local patch=${1#$SUBDIR_DOWN$QUILT_PATCHES/}
- local bre=$(quote_bre "$patch")
+ local bre=$(quote_sed_re "$patch")
set -- $(sed -e "/^$bre\(\|\.patch\|\.diff\?\)\(\|\.gz\|\.bz2\|\.xz\|\.lzma\|\.lz\)\([ "$'\t'"]\|$\)/!d" \
-e 's/[ '$'\t''].*//' "$SERIES")
if [ $# -eq 1 ]
@@ -631,7 +637,7 @@ files_in_patch()
then
find "$path" -type f \
-a ! -path "$(quote_glob "$path")/.timestamp" |
- sed -e "s/$(quote_bre "$path")\///"
+ sed -e "s/$(quote_sed_re "$path")\///"
fi
}
diff --git a/quilt/upgrade.in b/quilt/upgrade.in
index dbf7d05bd2b7..866aa339d41e 100644
--- a/quilt/upgrade.in
+++ b/quilt/upgrade.in
@@ -74,7 +74,7 @@ printf $"Converting meta-data to version %s\n" "$DB_VERSION"
for patch in $(applied_patches)
do
- proper_name="$(grep "^$(quote_bre $patch)"'\(\|\.patch\|\.diff?\)\(\|\.gz\|\.bz2\)\([ \t]\|$\)' $SERIES)"
+ proper_name="$(grep "^$(quote_grep_re $patch)"'\(\|\.patch\|\.diff?\)\(\|\.gz\|\.bz2\)\([ \t]\|$\)' $SERIES)"
proper_name=${proper_name#$QUILT_PATCHES/}
proper_name=${proper_name%% *}
if [ -z "$proper_name" ]
@@ -84,7 +84,7 @@ do
fi
if [ "$patch" != "$proper_name" -a -d $QUILT_PC/$patch ] \
- && grep -q "^$(quote_bre $patch)\$" \
+ && grep -q "^$(quote_grep_re $patch)\$" \
$QUILT_PC/applied-patches
then
mv $QUILT_PC/$patch $QUILT_PC/$proper_name \

View File

@ -1,367 +0,0 @@
Index: quilt-0.50/quilt/expand.in
===================================================================
--- /dev/null
+++ quilt-0.50/quilt/expand.in
@@ -0,0 +1,236 @@
+#! @BASH@
+
+# This script is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# See the COPYING and AUTHORS files for more details.
+
+# Read in library functions
+if [ "$(type -t patch_file_name)" != function ]
+then
+ if ! [ -r $QUILT_DIR/scripts/patchfns ]
+ then
+ echo "Cannot read library @SCRIPTS@/patchfns" >&2
+ exit 1
+ fi
+ . $QUILT_DIR/scripts/patchfns
+fi
+
+usage()
+{
+ printf $"Usage: quilt expand [patch]\n"
+ if [ x$1 = x-h ]
+ then
+ printf $"
+Expand the topmost or specified collapsed patch into its individual patches.
+"
+ exit 0
+ else
+ exit 1
+ fi
+}
+
+fill_orig() {
+ local orig=$1 patch exclude
+
+ cp -rld "$QUILT_PC/$combined_patch" "$orig"
+
+ for patch in $(patches_after "$combined_patch")
+ do
+ is_applied "$patch" || break
+ ( cd "$QUILT_PC/$patch" \
+ && find -type f \
+ | xargs -r cp -il --parents --target-directory "$orig" \
+ 2> /dev/null
+ )
+ done
+
+ if [ ${QUILT_PATCHES:0:1} != / ]
+ then
+ exclude="$exclude"'-path "./$QUILT_PATCHES" -prune -o '
+ fi
+ if [ ${QUILT_PC:0:1} != / ]
+ then
+ exclude="$exclude"'-path "./$QUILT_PC" -prune -o '
+ fi
+ eval find $exclude -type f -print \
+ | xargs -r cp -il --parents --target-directory "$orig" \
+ 2> /dev/null
+
+ find "$orig" -size 0 \
+ | xargs -r rm -f
+}
+
+move_pc_dirs() {
+ local pc_dir=$1
+
+ for ((n = 0; n < ${#patches[@]}; n++))
+ do
+ mkdir -p $(dirname "$QUILT_PC/${patches[n]}") \
+ && mv "$pc_dir/${patches[n]}" "$QUILT_PC/${patches[n]}" \
+ || return 1
+ done
+}
+
+expand_in_list() {
+ local series=$1 replace=$2 tmpfile=$(gen_tempfile $series.XXXXXX)
+ awk '
+ /^'"$(quote_re $combined_patch)"'([ \t]|$)/ \
+ { print patches
+ replaced++
+ next }
+ { print }
+ END { exit (replaced != 1) }
+ ' patches="$replace" \
+ < $series > $tmpfile
+ if [ $? = 0 ]
+ then
+ mv $tmpfile $series
+ else
+ rm -f $tmpfile
+ return 1
+ fi
+}
+
+options=`getopt -o h --long help: -- "$@"`
+
+if [ $? -ne 0 ]
+then
+ usage
+fi
+
+eval set -- "$options"
+
+while true
+do
+ case "$1" in
+ -h)
+ usage -h ;;
+ --)
+ shift
+ break ;;
+ esac
+done
+
+if [ $# -gt 1 ]
+then
+ usage
+fi
+
+if [ -n "$1" ]
+then
+ if ! combined_patch=$(find_patch $1)
+ then
+ printf $"Patch %s is not in series file\n" "$1" >&2
+ exit 1
+ fi
+else
+ if ! combined_patch=$(top_patch)
+ then
+ printf $"No patches applied\n" >&2
+ exit 1
+ fi
+fi
+
+combined_series=$(patch_file_name $combined_patch \
+ | sed -e 's:\.gz$::' -e 's:\.bz2$::' -e 's:\.xz$::' -e 's:\.lzma$::').series
+
+if ! [ -f "$combined_series" ]
+then
+ printf $"Patch %s is not a combined patch\n" "$(print_patch "$1")"
+ exit 1
+fi
+
+patches=( $(sed -e $'s:[ \t].*::' $combined_series) )
+
+if ! is_applied "$combined_patch"
+then
+ for ((n = 0; n < ${#patches[@]}; n++))
+ do
+ printf $"Applying patch %s\n" "$(print_patch "${patches[n]}")"
+ done
+ if ! expand_in_list "$SERIES" "$(< "$combined_series")"
+ then
+ printf "Expanding %s failed\n" \
+ "$(print_patch "$combined_patch")"
+ exit 1
+ fi
+ exit 0
+fi
+
+for ((n = 0; n < ${#patches[@]}; n++))
+do
+ patch=${patches[n]}
+ if ! [ -e "$(patch_file_name "$patch")" ]
+ then
+ printf $"Component patch %s of %s not found\n" "$patch" \
+ "$(print_patch "$combined_patch")"
+ exit 1
+ fi
+ if is_applied "$patch"
+ then
+ printf $"Component patch %s of %s appears to be applied\n" \
+ "$(print_patch "$patch")" \
+ "$(print_patch "$combined_patch")"
+ exit 1
+ fi
+done
+
+tmpdir=$(gen_tempfile -d $QUILT_PC/expand)
+trap "rm -rf $tmpdir" EXIT
+
+[ "${tmpdir:0:1}" = / ] || tmpdir=$PWD/$tmpdir
+
+fill_orig $tmpdir/orig
+cp -rld $tmpdir/orig $tmpdir/tree
+
+for ((n = 0; n < ${#patches[@]}; n++))
+do
+ patch=${patches[n]}
+ pc_dir=$tmpdir/pc/$patch
+ patch_args=$(SERIES=$combined_series; patch_args $patch)
+
+ printf $"Applying patch %s\n" "$(print_patch "$patch")"
+ if ! cat_file "$(patch_file_name "$patch")" \
+ | patch $QUILT_PATCH_OPTS $patch_args \
+ --backup --prefix="$pc_dir/" \
+ -Efs -d "$tmpdir/tree" >/dev/null
+ then
+ printf $"Patch %s does not apply; aborting expand\n" \
+ "$(print_patch "$patch")"
+ exit 1
+ fi
+ touch $pc_dir/.timestamp
+done
+
+printf $"Verifying against patch %s\n" "$(print_patch "$combined_patch")"
+if ! cat_file "$(patch_file_name "$combined_patch")" \
+ | patch $QUILT_PATCH_OPTS $(patch_args $combined_patch) \
+ --no-backup-if-mismatch -Efs -d "$tmpdir/orig" >/dev/null
+then
+ printf $"Patch %s does not apply; aborting expand\n" \
+ "$(print_patch "combined_patch")"
+ exit 1
+fi
+
+if ! diff -Nqr "$tmpdir/orig" "$tmpdir/tree" > /dev/null
+then
+ diff -Nur "$tmpdir/orig" "$tmpdir/tree"
+ printf $"The patches do not add up to the combined patch\n"
+ exit 1
+fi
+
+if ! move_pc_dirs "$tmpdir/pc" ||
+ ! expand_in_list $DB "$(sed -e $'s:[ \t].*::' "$combined_series")" ||
+ ! expand_in_list "$SERIES" "$(< "$combined_series")" ||
+ ! rm -rf $QUILT_PC/$combined_patch
+then
+ printf "Expanding %s failed\n" "$(print_patch "$combined_patch")"
+ exit 1
+fi
+
+### Local Variables:
+### mode: shell-script
+### End:
+# vim:filetype=sh
Index: quilt-0.50/test/expand.test
===================================================================
--- /dev/null
+++ quilt-0.50/test/expand.test
@@ -0,0 +1,121 @@
+ $ rm -rf d
+ $ mkdir -p d/patches
+ $ cd d
+
+ $ echo not part of any > patch
+ $ echo foo > foo
+ $ echo bar > bar
+ $ echo void > void
+ $ quilt new patch1
+ > Patch patches/patch1 is now on top
+
+ $ quilt add foo
+ > File foo added to patch patches/patch1
+
+ $ echo foo2 > foo
+ $ quilt refresh
+ > Refreshed patch patches/patch1
+
+ $ quilt new subdir/patch2
+ > Patch patches/subdir/patch2 is now on top
+
+ $ quilt add bar void
+ > File bar added to patch patches/subdir/patch2
+ > File void added to patch patches/subdir/patch2
+
+ $ echo bar2 > bar
+ $ rm void
+ $ quilt refresh
+ > Refreshed patch patches/subdir/patch2
+
+ $ quilt diff -p0 --combine - --no-index > patches/combined
+ $ quilt pop -qa
+ > Removing patch patches/subdir/patch2
+ > Removing patch patches/patch1
+ > No patches applied
+
+ $ mv patches/series patches/combined.series
+ $ echo combined -p0 > patches/series
+ $ quilt push -q
+ > Applying patch patches/combined
+ > Now at patch patches/combined
+
+ $ quilt expand
+ > Applying patch patches/patch1
+ > Applying patch patches/subdir/patch2
+ > Verifying against patch patches/combined
+
+ $ quilt series
+ > patches/patch1
+ > patches/subdir/patch2
+
+ $ quilt pop -qaR
+ > Removing patch patches/subdir/patch2
+ > Removing patch patches/patch1
+ > No patches applied
+
+ $ quilt push -qa
+ > Applying patch patches/patch1
+ > Applying patch patches/subdir/patch2
+ > Now at patch patches/subdir/patch2
+
+ $ quilt new patch3
+ > Patch patches/patch3 is now on top
+
+ $ quilt add void
+ > File void added to patch patches/patch3
+
+ $ echo void > void
+ $ quilt refresh -p0
+ > Refreshed patch patches/patch3
+
+ $ mkdir -p patches/subdir2
+ $ quilt diff -p1 --combine - --no-index > patches/subdir2/combined2
+ $ quilt pop -qaR
+ > Removing patch patches/patch3
+ > Removing patch patches/subdir/patch2
+ > Removing patch patches/patch1
+ > No patches applied
+
+ $ mv patches/series patches/subdir2/combined2.series
+ $ echo subdir2/combined2 > patches/series
+ $ quilt push -q
+ > Applying patch patches/subdir2/combined2
+ > Now at patch patches/subdir2/combined2
+
+ $ quilt expand
+ > Applying patch patches/patch1
+ > Applying patch patches/subdir/patch2
+ > Applying patch patches/patch3
+ > Verifying against patch patches/subdir2/combined2
+
+ $ quilt series
+ > patches/patch1
+ > patches/subdir/patch2
+ > patches/patch3
+
+ $ quilt pop -qaR
+ > Removing patch patches/patch3
+ > Removing patch patches/subdir/patch2
+ > Removing patch patches/patch1
+ > No patches applied
+
+ $ cat foo bar void
+ > foo
+ > bar
+ > void
+
+ $ echo subdir2/combined2 > patches/series
+
+ $ quilt expand subdir2/combined2
+ > Applying patch patches/patch1
+ > Applying patch patches/subdir/patch2
+ > Applying patch patches/patch3
+
+ $ quilt series
+ > patches/patch1
+ > patches/subdir/patch2
+ > patches/patch3
+
+ $ cd ..
+ $ rm -rf d

View File

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

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

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

View File

@ -1,3 +1,27 @@
-------------------------------------------------------------------
Thu Mar 28 13:37:03 UTC 2024 - Jean Delvare <jdelvare@suse.com>
- Update to version 0.68:
* Add support for zstd archives
* Documentation: Massive formatting update of the manual page
* Documentation: Reword some sections of the manual page
* Fix compatibility with GNU awk version 5.0.0 and later
* Test suite: Fix various race conditions (savannah#63651)
* patches: Find file name with a space in unapplied patches
(savannah#41708)
* pop: Hint at diff -z on failure
* setup: Better explain the limitation of spec file support
* Obsoletes avoid-warnings-with-grep-3.8.patch
* Obsoletes setup-document-the-limitation-of-spec-file-support.patch
* Obsoletes test-faildiff-workaround-order-bug.patch
- Drop expand.diff. This extra command was written 19 years ago
but was never added upstream, and recent upstream changes broke
it. I never used it, I think we can live without it. If anyone
really misses the functionality then the patch should be sent
upstream and get properly reviewed there.
- Recommend unzip, as the setup command may need it (bsc#1201950).
- Recommend zstd when available, now that it is supported.
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Feb 20 14:05:15 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org> Tue Feb 20 14:05:15 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org>

View File

@ -1,7 +1,7 @@
# #
# spec file for package quilt # spec file for package quilt
# #
# Copyright (c) 2022 SUSE LLC # Copyright (c) 2024 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -17,7 +17,7 @@
Name: quilt Name: quilt
Version: 0.67 Version: 0.68
Release: 0 Release: 0
Summary: A Tool for Working with Many Patches Summary: A Tool for Working with Many Patches
License: GPL-2.0-or-later License: GPL-2.0-or-later
@ -25,6 +25,7 @@ Group: Development/Tools/Version Control
BuildRequires: diffstat BuildRequires: diffstat
BuildRequires: ed BuildRequires: ed
BuildRequires: emacs-nox BuildRequires: emacs-nox
BuildRequires: xz
Requires: coreutils Requires: coreutils
Requires: diffstat Requires: diffstat
Requires: diffutils Requires: diffutils
@ -36,13 +37,9 @@ Requires: mktemp
Requires: patch Requires: patch
Requires: perl Requires: perl
URL: http://savannah.nongnu.org/projects/quilt URL: http://savannah.nongnu.org/projects/quilt
Source: %{name}-%{version}.tar.bz2 Source: %{name}-%{version}.tar.xz
Source1: suse-start-quilt-mode.el Source1: suse-start-quilt-mode.el
Patch1: avoid-warnings-with-grep-3.8.patch
Patch2: setup-document-the-limitation-of-spec-file-support.patch
Patch81: expand.diff
Patch82: quilt-support-vimdiff.patch Patch82: quilt-support-vimdiff.patch
Patch83: test-faildiff-workaround-order-bug.patch
Patch84: suse-workaround-pseudo-release.patch Patch84: suse-workaround-pseudo-release.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch BuildArch: noarch
@ -51,10 +48,14 @@ Recommends: /usr/bin/rpmbuild
Recommends: bzip2 Recommends: bzip2
Recommends: ed Recommends: ed
Recommends: procmail Recommends: procmail
Recommends: unzip
%endif %endif
%if 0%{?suse_version} > 1120 %if 0%{?suse_version} > 1120
Recommends: xz Recommends: xz
%endif %endif
%if 0%{?suse_version} > 1210
Recommends: zstd
%endif
%description %description
Quilt allows you to easily manage large numbers of patches by keeping Quilt allows you to easily manage large numbers of patches by keeping

View File

@ -1,38 +0,0 @@
From: Jean Delvare <jdelvare@suse.de>
Date: Thu, 6 Oct 2022 18:52:52 +0200
Subject: setup: Document the limitation of spec file support
Git-commit: b73e4afa7e4c28a981430c5b80a95254f2ed6b77
Patch-mainline: yes
References: boo#1203791
Quilt setup can't be used on arbitrary spec files. Due to the fact
that quilt only deals with patches, every other modification to the
working tree has to happen first, and the patches must be applied
last.
This is a design limitation and not a bug, but document it so that
the users are aware of it and can adjust the %prep section of their
spec file if needed.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
quilt/setup.in | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/quilt/setup.in
+++ b/quilt/setup.in
@@ -279,7 +279,13 @@ Initializes a source tree from an rpm sp
--fast Use the new, faster method to process the spec file. In this mode,
rpmbuild is told to generate a working tree directly in the target
- directory. This is now the default.
+ directory. This is the default (since quilt version 0.67).
+
+The setup command is only guaranteed to work properly on spec files where
+applying all the patches is the last thing done in the %%prep section. This is
+a design limitation due to the fact that quilt can only operate on patches. If
+other commands in the %%prep section modify the patched files, this must
+happen first, otherwise you won't be able to push the patch series.
"
exit 0
else

View File

@ -1,22 +0,0 @@
The test suite does not differentiate between stdout and stderr. When
messages are printed to both, the order in which they will reach us
is apparently no guaranteed. Ideally this would be deterministic, but
until then, I don't want to waste Build Service resources with
useless rebuilds, so let's just test stdout and stderr separately.
---
test/faildiff.test | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/test/faildiff.test
+++ b/test/faildiff.test
@@ -27,8 +27,9 @@ What happens on binary files?
> File test.bin added to patch %{P}test.diff
$ printf "\\003\\000\\001" > test.bin
- $ quilt diff -pab --no-index
+ $ quilt diff -pab --no-index 2>/dev/null
>~ (Files|Binary files) a/test\.bin and b/test\.bin differ
+ $ quilt diff -pab --no-index >/dev/null
> Diff failed on file 'test.bin', aborting
$ echo %{?}
> 1