quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Quilt-dev] [PATCH] setup: Add basic support for p7zip (.7z) archives


From: Jean Delvare
Subject: [Quilt-dev] [PATCH] setup: Add basic support for p7zip (.7z) archives
Date: Mon, 05 Dec 2016 18:23:22 +0100

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.
* 7za is very verbose, and doesn't offer any option to be silent or
  even just quieter.
---
 quilt/scripts/inspect-wrapper.in |   26 ++++++++++++++++++++++++++
 quilt/setup.in                   |   20 ++++++++++++++++++--
 2 files changed, 44 insertions(+), 2 deletions(-)

--- a/quilt/scripts/inspect-wrapper.in
+++ b/quilt/scripts/inspect-wrapper.in
@@ -189,6 +189,23 @@ unzip_input_file()
        return 1
 }
 
+_7za_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 "$@")
        ;;
+7za)
+       echo -n 7 >&4
+       [ -n "$QUILT_SETUP_FAST" ] && exec 7za "$@"
+       inputfile=$(_7za_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
        ;;
+7za)
+       dir=$(pwd_to_dir)
+       echo "7za ${dir:-.} $unpackfile" >&3
+       ;;
 esac
 
 # In fast mode, we don't actually apply patches
--- 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/7za
 
        # 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/7za" \
                 --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 "7za ${tar_dir:-.} ${source// /\\ }"
+                               ;;
                        *)
                                echo "tar ${tar_dir:-.} ${source// /\\ }"
                                ;;
@@ -448,6 +453,17 @@ then
                        mkdir -p "${prefix:-.}" "$prefix$dir"
                        unzip -qqo "$tarball" -d "$prefix$dir"
                        ;;
+               7za)
+                       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"
+                       7za 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|7za)
                tar_dir=$dir
                [ "$tar_dir" = . ] && tar_dir=
                tar_file=$arg1

-- 
Jean Delvare
SUSE L3 Support




reply via email to

[Prev in Thread] Current Thread [Next in Thread]