quilt-dev
[Top][All Lists]
Advanced

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

[Quilt-dev] [PATCH] setup/inspect: Handle zip archives referenced in spe


From: Jean Delvare
Subject: [Quilt-dev] [PATCH] setup/inspect: Handle zip archives referenced in spec files
Date: Thu, 18 Oct 2012 10:58:15 +0200

Let quilt setup handle zip archives referenced in spec files.

---
Note that I did not handle zip files in series file, as I don't
know if it is needed at all. Are series file as input to quilt
setup used outside of the test suite? Is there a document
describing their format?

 quilt/scripts/inspect.in |   28 ++++++++++++++++++++++++++++
 quilt/setup.in           |   11 +++++++++++
 2 files changed, 39 insertions(+)

--- 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
@@ -198,6 +198,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"
+               (cd "$prefix$dir" && unzip -qq "$tarball")
+               ;;
        esac
 done < $tmpfile
 

-- 
Jean Delvare
Suse L3




reply via email to

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