forked from pool/quilt
Accepting request 139312 from devel:tools:scm
Many improvements to "quilt setup". OBS-URL: https://build.opensuse.org/request/show/139312 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/quilt?expand=0&rev=45
This commit is contained in:
commit
a00df87d7a
35
quilt-setup-01-check-existing-files-after-unpack.patch
Normal file
35
quilt-setup-01-check-existing-files-after-unpack.patch
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
From: Jean Delvare <jdelvare@suse.de>
|
||||||
|
Subject: setup: Check for existing files after unpacking
|
||||||
|
|
||||||
|
setup: check for existing files after unpacking the tar files, not
|
||||||
|
before, otherwise we check too early and a tar file containing a
|
||||||
|
"patches" directory will not be handled properly.
|
||||||
|
---
|
||||||
|
Originally (commit b704611d) existing files were checked for both
|
||||||
|
before and after unpacking the tar files. Commit 639f2f9c dropped
|
||||||
|
the second check, while I believe it should have dropped the first.
|
||||||
|
Andreas, is there any reason to check before unpacking too?
|
||||||
|
|
||||||
|
quilt/setup.in | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
--- a/quilt/setup.in
|
||||||
|
+++ b/quilt/setup.in
|
||||||
|
@@ -183,8 +183,6 @@ case "$1" in
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
-check_for_existing_files || exit 1
|
||||||
|
-
|
||||||
|
while read tag dir arg1 arg2
|
||||||
|
do
|
||||||
|
case "$tag" in
|
||||||
|
@@ -203,6 +201,8 @@ do
|
||||||
|
esac
|
||||||
|
done < $tmpfile
|
||||||
|
|
||||||
|
+check_for_existing_files || exit 1
|
||||||
|
+
|
||||||
|
while read tag dir arg1 arg2
|
||||||
|
do
|
||||||
|
case "$tag" in
|
26
quilt-setup-02-try-alternative-names.patch
Normal file
26
quilt-setup-02-try-alternative-names.patch
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
From: Jean Delvare <jdelvare@suse.de>
|
||||||
|
Subject: setup: Try alternative patches/series names
|
||||||
|
|
||||||
|
setup: If a tar file contains a patches directory or a series file,
|
||||||
|
automatically try alternative names which are less likely to collide.
|
||||||
|
---
|
||||||
|
quilt/setup.in | 8 +++++++-
|
||||||
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
--- a/quilt/setup.in
|
||||||
|
+++ b/quilt/setup.in
|
||||||
|
@@ -201,7 +201,13 @@ do
|
||||||
|
esac
|
||||||
|
done < $tmpfile
|
||||||
|
|
||||||
|
-check_for_existing_files || exit 1
|
||||||
|
+if ! check_for_existing_files
|
||||||
|
+then
|
||||||
|
+ echo "Trying alternative patches and series names..." >&2
|
||||||
|
+ QUILT_PATCHES=quilt_patches
|
||||||
|
+ QUILT_SERIES=quilt_series
|
||||||
|
+ check_for_existing_files || exit 1
|
||||||
|
+fi
|
||||||
|
|
||||||
|
while read tag dir arg1 arg2
|
||||||
|
do
|
70
quilt-setup-03-remember-alternative-names.patch
Normal file
70
quilt-setup-03-remember-alternative-names.patch
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
From: Jean Delvare <jdelvare@suse.de>
|
||||||
|
Subject: setup: Run create_db
|
||||||
|
|
||||||
|
Run create_db() as part of quilt setup, so that $QUILT_PATCHES and
|
||||||
|
$QUILT_SERIES are recorded for future quilt commands.
|
||||||
|
---
|
||||||
|
quilt/setup.in | 8 ++++++--
|
||||||
|
test/setup.test | 26 ++++++++++++++++++++++++++
|
||||||
|
2 files changed, 32 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
--- a/quilt/setup.in
|
||||||
|
+++ b/quilt/setup.in
|
||||||
|
@@ -218,8 +218,12 @@ do
|
||||||
|
tar_file="$arg1"
|
||||||
|
;;
|
||||||
|
patch)
|
||||||
|
- [ -e "$prefix$dir/$QUILT_PATCHES" ] \
|
||||||
|
- || create_symlink "$sourcedir" "$prefix$dir/$QUILT_PATCHES"
|
||||||
|
+ if [ ! -e "$prefix$dir/$QUILT_PATCHES" ]
|
||||||
|
+ then
|
||||||
|
+ create_symlink "$sourcedir" "$prefix$dir/$QUILT_PATCHES"
|
||||||
|
+ (cd "$prefix$dir" && create_db)
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
if [ -n "$series_file" ]
|
||||||
|
then
|
||||||
|
[ -e "$prefix$dir/$QUILT_SERIES" ] \
|
||||||
|
--- a/test/setup.test
|
||||||
|
+++ b/test/setup.test
|
||||||
|
@@ -7,7 +7,11 @@ $ diff -u dir/foo.orig dir/foo > revert.
|
||||||
|
$ diff -u dir/foo.orig dir/foo > again.diff
|
||||||
|
$ mv dir/foo.orig dir/foo
|
||||||
|
$ tar cf - dir | gzip > dir.tar.gz
|
||||||
|
+$ mkdir dir/patches
|
||||||
|
+$ echo crap > dir/patches/foo.diff
|
||||||
|
+$ tar cf - dir | gzip > dir_with_patches.tar.gz
|
||||||
|
$ rm -rf dir
|
||||||
|
+
|
||||||
|
$ cat > series
|
||||||
|
< # Source: dir.tar.gz
|
||||||
|
< # Patchdir: dir
|
||||||
|
@@ -57,6 +61,28 @@ $ quilt push -qa
|
||||||
|
> Applying patch patches/revert.diff
|
||||||
|
> Applying patch patches/again.diff
|
||||||
|
> Now at patch patches/again.diff
|
||||||
|
+$ cd ../..
|
||||||
|
+$ rm -rf "dir"
|
||||||
|
+
|
||||||
|
+# Now test the case where the tarball contains a patches directory
|
||||||
|
+$ cat > series_with_patches
|
||||||
|
+< # Source: dir_with_patches.tar.gz
|
||||||
|
+< # Patchdir: dir
|
||||||
|
+< #
|
||||||
|
+< foo.diff
|
||||||
|
+$ quilt setup series_with_patches
|
||||||
|
+> Unpacking archive dir_with_patches.tar.gz
|
||||||
|
+> Directory dir/patches exists
|
||||||
|
+> Trying alternative patches and series names...
|
||||||
|
+$ cd dir
|
||||||
|
+$ ls -l quilt_patches quilt_series | sed -e 's:.* -> ::'
|
||||||
|
+> ..
|
||||||
|
+> ../series_with_patches
|
||||||
|
+$ quilt push -qa
|
||||||
|
+> Applying patch quilt_patches/foo.diff
|
||||||
|
+> Now at patch quilt_patches/foo.diff
|
||||||
|
+$ cd ..
|
||||||
|
+$ rm -rf "dir"
|
||||||
|
|
||||||
|
# Now a basic test with space in dir name
|
||||||
|
$ mkdir "space [dir]"
|
118
quilt-setup-04-handle-zip-files.patch
Normal file
118
quilt-setup-04-handle-zip-files.patch
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
Let quilt setup handle zip archives referenced in spec files.
|
||||||
|
|
||||||
|
---
|
||||||
|
quilt/scripts/inspect.in | 28 ++++++++++++++++++++++++++++
|
||||||
|
quilt/setup.in | 23 +++++++++++++++++++++--
|
||||||
|
2 files changed, 49 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
--- a/quilt/scripts/inspect.in
|
||||||
|
+++ b/quilt/scripts/inspect.in
|
||||||
|
@@ -251,6 +251,21 @@ cat <<-'EOF' > $tmpdir/bin/wrapper
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
+ unzip_input_file() {
|
||||||
|
+ while [ $# -gt 0 ]; do
|
||||||
|
+ case "$1" in
|
||||||
|
+ -*)
|
||||||
|
+ shift
|
||||||
|
+ ;;
|
||||||
|
+ *)
|
||||||
|
+ echo "$1"
|
||||||
|
+ return
|
||||||
|
+ ;;
|
||||||
|
+ esac
|
||||||
|
+ done
|
||||||
|
+ return 1
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
tar_opt_C() {
|
||||||
|
case "$1" in
|
||||||
|
*C*f*)
|
||||||
|
@@ -270,6 +285,9 @@ cat <<-'EOF' > $tmpdir/bin/wrapper
|
||||||
|
# For tar, file - means read from stdin
|
||||||
|
[ "$inputfile" = "-" ] && inputfile=
|
||||||
|
;;
|
||||||
|
+ unzip)
|
||||||
|
+ inputfile=$(unzip_input_file "$@")
|
||||||
|
+ ;;
|
||||||
|
esac
|
||||||
|
if [ -z "$inputfile" ]; then
|
||||||
|
# put data from stdin into tmpfile
|
||||||
|
@@ -309,6 +327,14 @@ cat <<-'EOF' > $tmpdir/bin/wrapper
|
||||||
|
dir=${dir// /\\ }
|
||||||
|
echo "${0##*/} ${dir:-.} $unpackfile" >&3
|
||||||
|
;;
|
||||||
|
+ unzip)
|
||||||
|
+ echo -n Z >&4
|
||||||
|
+ dir=$PWD
|
||||||
|
+ dir=${dir/$RPM_BUILD_DIR}
|
||||||
|
+ dir=${dir##/}
|
||||||
|
+ dir=${dir// /\\ }
|
||||||
|
+ echo "${0##*/} ${dir:-.} $unpackfile" >&3
|
||||||
|
+ ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
@@ -333,6 +359,7 @@ fi
|
||||||
|
|
||||||
|
ln -s wrapper $tmpdir/bin/patch
|
||||||
|
ln -s wrapper $tmpdir/bin/tar
|
||||||
|
+ln -s wrapper $tmpdir/bin/unzip
|
||||||
|
|
||||||
|
# let rpm do all the dirty specfile stuff ...
|
||||||
|
echo -n "### rpmbuild: " >&4
|
||||||
|
@@ -343,6 +370,7 @@ rpmbuild --eval "%define _sourcedir $sou
|
||||||
|
--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_FUZZ" \
|
||||||
|
--nodeps \
|
||||||
|
-bp "$specdir/$specfile" < /dev/null >&5 2>&5
|
||||||
|
--- a/quilt/setup.in
|
||||||
|
+++ b/quilt/setup.in
|
||||||
|
@@ -167,7 +167,15 @@ case "$1" in
|
||||||
|
"# Source: "*)
|
||||||
|
shift 2
|
||||||
|
source="$@"
|
||||||
|
- echo "tar ${tar_dir:-.} ${source// /\\ }"
|
||||||
|
+ filetype="$(file -b "$source")"
|
||||||
|
+ case "$filetype" in
|
||||||
|
+ Zip*)
|
||||||
|
+ echo "unzip ${tar_dir:-.} ${source// /\\ }"
|
||||||
|
+ ;;
|
||||||
|
+ *)
|
||||||
|
+ echo "tar ${tar_dir:-.} ${source// /\\ }"
|
||||||
|
+ ;;
|
||||||
|
+ esac
|
||||||
|
;;
|
||||||
|
"# Patchdir: "*)
|
||||||
|
shift 2
|
||||||
|
@@ -198,6 +206,17 @@ do
|
||||||
|
cat_file "$tarball" \
|
||||||
|
| tar xf - -C "$prefix$dir"
|
||||||
|
;;
|
||||||
|
+ unzip)
|
||||||
|
+ tarball=$sourcedir$arg1
|
||||||
|
+ if [ ! -e "$tarball" ]
|
||||||
|
+ then
|
||||||
|
+ printf $"File %s not found\n" "$tarball" >&2
|
||||||
|
+ exit 1
|
||||||
|
+ fi
|
||||||
|
+ printf $"Unpacking archive %s\n" "$tarball"
|
||||||
|
+ mkdir -p "${prefix:-.}" "$prefix$dir"
|
||||||
|
+ unzip -qqo "$tarball" -d "$prefix$dir"
|
||||||
|
+ ;;
|
||||||
|
esac
|
||||||
|
done < $tmpfile
|
||||||
|
|
||||||
|
@@ -212,7 +231,7 @@ fi
|
||||||
|
while read tag dir arg1 arg2
|
||||||
|
do
|
||||||
|
case "$tag" in
|
||||||
|
- tar)
|
||||||
|
+ tar|unzip)
|
||||||
|
tar_dir="$dir"
|
||||||
|
[ "$tar_dir" = . ] && tar_dir=
|
||||||
|
tar_file="$arg1"
|
37
quilt-setup-05-fix-check_for_existing_files.patch
Normal file
37
quilt-setup-05-fix-check_for_existing_files.patch
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
Fix handling of directory names including white spaces by
|
||||||
|
check_for_existing_files. awk can't deal with tokens which include
|
||||||
|
white spaces, so use bash's read function instead.
|
||||||
|
|
||||||
|
As a side bonus, we get rid of the undocumented dependency to "uniq".
|
||||||
|
---
|
||||||
|
quilt/setup.in | 11 ++++++++---
|
||||||
|
1 file changed, 8 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
--- a/quilt/setup.in
|
||||||
|
+++ b/quilt/setup.in
|
||||||
|
@@ -23,9 +23,12 @@ then
|
||||||
|
fi
|
||||||
|
|
||||||
|
check_for_existing_files() {
|
||||||
|
- local dir status=0
|
||||||
|
- for dir in $(awk ' $1 == "patch" { print $2 }' $tmpfile | uniq)
|
||||||
|
+ local tag dir last_dir arg status=0
|
||||||
|
+
|
||||||
|
+ while read tag dir arg
|
||||||
|
do
|
||||||
|
+ [ "$tag" = "patch" -a "$dir" != "$last_dir" ] || continue
|
||||||
|
+
|
||||||
|
if [ -e "$prefix$dir/$QUILT_PATCHES" ]
|
||||||
|
then
|
||||||
|
printf $"Directory %s exists\n" \
|
||||||
|
@@ -38,7 +41,9 @@ check_for_existing_files() {
|
||||||
|
"$prefix$dir/$QUILT_SERIES" >&2
|
||||||
|
status=1
|
||||||
|
fi
|
||||||
|
- done
|
||||||
|
+ last_dir=$dir
|
||||||
|
+ done < $tmpfile
|
||||||
|
+
|
||||||
|
return $status
|
||||||
|
}
|
||||||
|
|
65
quilt-setup-06-check-for-directories-too.patch
Normal file
65
quilt-setup-06-check-for-directories-too.patch
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
Check for existing directories before unpacking.
|
||||||
|
---
|
||||||
|
quilt/setup.in | 22 ++++++++++++++++++++++
|
||||||
|
test/setup.test | 7 ++++++-
|
||||||
|
2 files changed, 28 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
--- a/quilt/setup.in
|
||||||
|
+++ b/quilt/setup.in
|
||||||
|
@@ -22,6 +22,25 @@ then
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
+check_for_existing_directories() {
|
||||||
|
+ local tag dir last_dir arg status=0
|
||||||
|
+
|
||||||
|
+ while read tag dir arg
|
||||||
|
+ do
|
||||||
|
+ [ "$dir" != "." -a "$dir" != "$last_dir" ] || continue
|
||||||
|
+
|
||||||
|
+ if [ -e "$prefix$dir" ]
|
||||||
|
+ then
|
||||||
|
+ printf $"Directory %s exists\n" \
|
||||||
|
+ "$prefix$dir" >&2
|
||||||
|
+ status=1
|
||||||
|
+ fi
|
||||||
|
+ last_dir=$dir
|
||||||
|
+ done < $tmpfile
|
||||||
|
+
|
||||||
|
+ return $status
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
check_for_existing_files() {
|
||||||
|
local tag dir last_dir arg status=0
|
||||||
|
|
||||||
|
@@ -196,6 +215,9 @@ case "$1" in
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
+# Make sure that unpacking will not overwrite anything
|
||||||
|
+check_for_existing_directories || exit 1
|
||||||
|
+
|
||||||
|
while read tag dir arg1 arg2
|
||||||
|
do
|
||||||
|
case "$tag" in
|
||||||
|
--- a/test/setup.test
|
||||||
|
+++ b/test/setup.test
|
||||||
|
@@ -64,12 +64,17 @@ $ quilt push -qa
|
||||||
|
$ cd ../..
|
||||||
|
$ rm -rf "dir"
|
||||||
|
|
||||||
|
-# Now test the case where the tarball contains a patches directory
|
||||||
|
+# Now test the cases where the directory already exists, or the tarball
|
||||||
|
+# contains a patches directory
|
||||||
|
$ cat > series_with_patches
|
||||||
|
< # Source: dir_with_patches.tar.gz
|
||||||
|
< # Patchdir: dir
|
||||||
|
< #
|
||||||
|
< foo.diff
|
||||||
|
+$ mkdir dir
|
||||||
|
+$ quilt setup series_with_patches
|
||||||
|
+> Directory dir exists
|
||||||
|
+$ rmdir dir
|
||||||
|
$ quilt setup series_with_patches
|
||||||
|
> Unpacking archive dir_with_patches.tar.gz
|
||||||
|
> Directory dir/patches exists
|
@ -1,3 +1,34 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Oct 19 14:17:34 CEST 2012 - jdelvare@suse.de
|
||||||
|
|
||||||
|
- quilt.spec: Add myself as an author.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Oct 19 11:15:16 CEST 2012 - jdelvare@suse.de
|
||||||
|
|
||||||
|
- quilt-setup-04-handle-zip-files.patch: Refresh from upstream.
|
||||||
|
- quilt-setup-05-fix-check_for_existing_files.patch: Fix handling
|
||||||
|
of directory names including white spaces by
|
||||||
|
check_for_existing_files.
|
||||||
|
- quilt-setup-06-check-for-directories-too.patch: Check for
|
||||||
|
existing directories before unpacking.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Oct 17 21:42:44 CEST 2012 - jdelvare@suse.de
|
||||||
|
|
||||||
|
- quilt-setup-04-handle-zip-files.patch: Let quilt setup handle
|
||||||
|
zip archives referenced in spec files (bnc#768332).
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Oct 16 13:13:36 CEST 2012 - jdelvare@suse.de
|
||||||
|
|
||||||
|
- quilt-setup-01-check-existing-files-after-unpack.patch: setup:
|
||||||
|
Check for existing files after unpacking (bnc#785167).
|
||||||
|
- quilt-setup-02-try-alternative-names.patch: setup: Try
|
||||||
|
alternative patches/series names (bnc#785167).
|
||||||
|
- quilt-setup-03-remember-alternative-names.patch: setup: Run
|
||||||
|
create_db (bnc#785167).
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Mar 2 14:20:24 CET 2012 - jdelvare@suse.de
|
Fri Mar 2 14:20:24 CET 2012 - jdelvare@suse.de
|
||||||
|
|
||||||
|
13
quilt.spec
13
quilt.spec
@ -50,6 +50,12 @@ patch2: quilt-support-vimdiff.patch
|
|||||||
Patch3: patch-wrapper-rpm.diff
|
Patch3: patch-wrapper-rpm.diff
|
||||||
Patch5: suse-workaround-pseudo-release.patch
|
Patch5: suse-workaround-pseudo-release.patch
|
||||||
Patch6: quilt-stable-rebuild.patch
|
Patch6: quilt-stable-rebuild.patch
|
||||||
|
Patch7: quilt-setup-01-check-existing-files-after-unpack.patch
|
||||||
|
Patch8: quilt-setup-02-try-alternative-names.patch
|
||||||
|
Patch9: quilt-setup-03-remember-alternative-names.patch
|
||||||
|
Patch10: quilt-setup-04-handle-zip-files.patch
|
||||||
|
Patch11: quilt-setup-05-fix-check_for_existing_files.patch
|
||||||
|
Patch12: quilt-setup-06-check-for-directories-too.patch
|
||||||
Url: http://savannah.nongnu.org/projects/quilt
|
Url: http://savannah.nongnu.org/projects/quilt
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
@ -67,6 +73,7 @@ http://www.zip.com.au/~akpm/linux/patches/.
|
|||||||
Authors:
|
Authors:
|
||||||
--------
|
--------
|
||||||
Andreas Gruenbacher <agruen@suse.de>
|
Andreas Gruenbacher <agruen@suse.de>
|
||||||
|
Jean Delvare <jdelvare@suse.de>
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
@ -75,6 +82,12 @@ Authors:
|
|||||||
%patch3 -p1
|
%patch3 -p1
|
||||||
%patch5 -p1
|
%patch5 -p1
|
||||||
%patch6 -p1
|
%patch6 -p1
|
||||||
|
%patch7 -p1
|
||||||
|
%patch8 -p1
|
||||||
|
%patch9 -p1
|
||||||
|
%patch10 -p1
|
||||||
|
%patch11 -p1
|
||||||
|
%patch12 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
# --with-rpmbuild=/usr/lib/rpm/rpmb:
|
# --with-rpmbuild=/usr/lib/rpm/rpmb:
|
||||||
|
Loading…
Reference in New Issue
Block a user