summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2017-03-10 10:33:22 +0100
committerJean Delvare <jdelvare@suse.de>2017-03-10 10:33:22 +0100
commitf0b63c5b75336a666e457b1d20c04a6c0118248a (patch)
tree2c52c6bc1e8c6ae3bc1bd55428ad0d79b9d8b62a
parent1cde19389bc5805da713361ac32869388e42f592 (diff)
downloadquilt-f0b63c5b75336a666e457b1d20c04a6c0118248a.tar.gz
setup: Add basic support for p7zip (.7z) archives
This should work in the most basic case (no option used.) This only covers the case of archives being compressed with 7z, not patches. This should fix bug #49754: http://savannah.nongnu.org/bugs/?49754 Remaining issues: * 7z could also be used to compress patches, although nobody sane would do that. * 7z is very verbose, and doesn't offer any option to be silent or even just quieter.
-rw-r--r--Makefile.in1
-rw-r--r--configure.ac2
-rw-r--r--quilt/scripts/inspect-wrapper.in26
-rw-r--r--quilt/setup.in20
4 files changed, 47 insertions, 2 deletions
diff --git a/Makefile.in b/Makefile.in
index a43b054..cf1642e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -43,6 +43,7 @@ DIFFSTAT := @DIFFSTAT@
RPMBUILD := @RPMBUILD@
SENDMAIL := @SENDMAIL@
MD5SUM := @MD5SUM@
+7Z := @P7ZIP@
USE_NLS := @USE_NLS@
STAT_HARDLINK := @STAT_HARDLINK@
diff --git a/configure.ac b/configure.ac
index 31eee37..9632ef1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -411,6 +411,8 @@ AC_SUBST(docdir)
dnl Check for rpmbuild (v4) vs. rpm (v3)
QUILT_COMPAT_PROG_PATH_OPT(RPMBUILD, rpmbuild, [rpmbuild rpm])
+QUILT_COMPAT_PROG_PATH_OPT(P7ZIP, 7z, [7zr 7za 7z])
+
AC_SUBST(COMPAT_SYMLINKS)
AC_SUBST(COMPAT_PROGRAMS)
diff --git a/quilt/scripts/inspect-wrapper.in b/quilt/scripts/inspect-wrapper.in
index e26f672..7f7eb82 100644
--- a/quilt/scripts/inspect-wrapper.in
+++ b/quilt/scripts/inspect-wrapper.in
@@ -189,6 +189,23 @@ unzip_input_file()
return 1
}
+_7z_input_file()
+{
+ while [ $# -gt 0 ]
+ do
+ case "$1" in
+ -*|e|x)
+ shift
+ ;;
+ *)
+ echo "$1"
+ return
+ ;;
+ esac
+ done
+ return 1
+}
+
tar_opt_C()
{
case "$1" in
@@ -240,6 +257,11 @@ unzip)
[ -n "$QUILT_SETUP_FAST" ] && exec unzip "$@"
inputfile=$(unzip_input_file "$@")
;;
+7z)
+ echo -n 7 >&4
+ [ -n "$QUILT_SETUP_FAST" ] && exec 7z "$@"
+ inputfile=$(_7z_input_file "$@")
+ ;;
esac
# If the file was not passed as a parameter, try to identify stdin
@@ -296,6 +318,10 @@ unzip)
dir=$(pwd_to_dir)
echo "unzip ${dir:-.} $unpackfile" >&3
;;
+7z)
+ dir=$(pwd_to_dir)
+ echo "7z ${dir:-.} $unpackfile" >&3
+ ;;
esac
# In fast mode, we don't actually apply patches
diff --git a/quilt/setup.in b/quilt/setup.in
index c2f6ac5..1f7cfe4 100644
--- a/quilt/setup.in
+++ b/quilt/setup.in
@@ -141,7 +141,7 @@ create_md5sums()
;;
# In fast mode, we are only interested in patches, so filter out
# archives
- *.tar|*.tar.Z|*.tar.gz|*.tgz|*.tar.bz2|*.tar.xz|*.zip)
+ *.tar|*.tar.Z|*.tar.gz|*.tgz|*.tar.bz2|*.tar.xz|*.zip|*.7z)
[ -n "$QUILT_SETUP_FAST" ] && continue
;;
esac
@@ -220,6 +220,7 @@ inspect()
ln -s $QUILT_DIR/scripts/inspect-wrapper $tmpdir/bin/patch
ln -s $QUILT_DIR/scripts/inspect-wrapper $tmpdir/bin/tar
ln -s $QUILT_DIR/scripts/inspect-wrapper $tmpdir/bin/unzip
+ ln -s $QUILT_DIR/scripts/inspect-wrapper $tmpdir/bin/7z
# Redirect file descriptors
# 5 is used in verbose mode, 4 in non-verbose mode, and 2 for both (real errors)
@@ -253,6 +254,7 @@ inspect()
--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" \
--nodeps \
-bp "$specdir/$specfile" < /dev/null >&5 2>&5
@@ -396,6 +398,9 @@ case "$1" in
Zip*)
echo "unzip ${tar_dir:-.} ${source// /\\ }"
;;
+ 7z*)
+ echo "7z ${tar_dir:-.} ${source// /\\ }"
+ ;;
*)
echo "tar ${tar_dir:-.} ${source// /\\ }"
;;
@@ -448,6 +453,17 @@ then
mkdir -p "${prefix:-.}" "$prefix$dir"
unzip -qqo "$tarball" -d "$prefix$dir"
;;
+ 7z)
+ 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"
+ 7z x -bd "$tarball" -o"$prefix$dir"
+ ;;
esac
done < $tmpfile
fi
@@ -474,7 +490,7 @@ series_header()
while read tag dir arg1 arg2
do
case "$tag" in
- tar|unzip)
+ tar|unzip|7z)
tar_dir=$dir
[ "$tar_dir" = . ] && tar_dir=
tar_file=$arg1