SHA256
1
0
forked from pool/quilt
quilt/quilt-setup-04-handle-zip-files.patch
2012-10-17 19:43:30 +00:00

107 lines
2.4 KiB
Diff

References: bnc#768332
Let quilt setup handle zip archives referenced in spec files.
---
quilt/scripts/inspect.in | 33 +++++++++++++++++++++++++++++++++
quilt/setup.in | 11 +++++++++++
2 files changed, 44 insertions(+)
--- a/quilt/scripts/inspect.in
+++ b/quilt/scripts/inspect.in
@@ -133,6 +133,11 @@ do
set -- $(lzma -cd "$file" | md5sum)
echo "$1 $basename"
;;
+ Zip*)
+ # There is no uncompressed archive equivalent but
+ # still notify the user we are processing an archive.
+ echo -n "Z" >&4
+ ;;
esac
done > $tmpdir/md5sums
echo >&4
@@ -251,6 +256,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 +290,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 +332,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 +364,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 +375,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