summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaul Wold <sgw@linux.intel.com>2013-01-18 20:48:33 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-01-20 13:06:43 +0000
commite9b73c0b0113a68d599323b67c34726d88e4c5ac (patch)
treeceb930756e3454aee52c84868a46d0abfb00069a
parent59e15f671222077db57d394b1f022549fa3509ff (diff)
downloadpoky-e9b73c0b0113a68d599323b67c34726d88e4c5ac.tar.gz
rpm2cpio: Update to match rpm4 specs for decompression
[YOCTO #3753] (From OE-Core rev: 1377278187d20853304fe2689105f2848d796d86) Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xmeta/recipes-devtools/rpm/rpm/rpm2cpio40
1 files changed, 14 insertions, 26 deletions
diff --git a/meta/recipes-devtools/rpm/rpm/rpm2cpio b/meta/recipes-devtools/rpm/rpm/rpm2cpio
index 00c4ec549e..6bcef6a4ce 100755
--- a/meta/recipes-devtools/rpm/rpm/rpm2cpio
+++ b/meta/recipes-devtools/rpm/rpm/rpm2cpio
@@ -1,5 +1,8 @@
1#!/bin/sh 1#!/bin/sh
2 2
3# Prevent gawk >= 4.0.x from getting funny ideas wrt UTF in printf()
4LANG=C
5
3pkg=$1 6pkg=$1
4if [ "$pkg" = "" -o ! -e "$pkg" ]; then 7if [ "$pkg" = "" -o ! -e "$pkg" ]; then
5 echo "no package supplied" 1>&2 8 echo "no package supplied" 1>&2
@@ -22,30 +25,15 @@ dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9`
22 25
23hdrsize=`expr 8 + 16 \* $il + $dl` 26hdrsize=`expr 8 + 16 \* $il + $dl`
24o=`expr $o + $hdrsize` 27o=`expr $o + $hdrsize`
25EXTRACTOR="dd if=$pkg ibs=$o skip=1" 28comp=`dd if=$pkg ibs=$o skip=1 count=1 2>/dev/null | dd bs=3 count=1 2> /dev/null`
26
27COMPRESSION=`($EXTRACTOR |file -) 2>/dev/null`
28if echo $COMPRESSION |grep -q gzip; then
29 DECOMPRESSOR=gunzip
30elif echo $COMPRESSION |grep -q bzip2; then
31 DECOMPRESSOR=bunzip2
32elif echo $COMPRESSION |grep -q xz; then
33 DECOMPRESSOR=unxz
34elif echo $COMPRESSION |grep -q cpio; then
35 DECOMPRESSOR=cat
36else
37 # Most versions of file don't support LZMA, therefore we assume
38 # anything not detected is LZMA
39 DECOMPRESSOR=`which unlzma 2>/dev/null`
40 case "$DECOMPRESSOR" in
41 /* ) ;;
42 * ) DECOMPRESSOR=`which lzmash 2>/dev/null`
43 case "$DECOMPRESSOR" in
44 /* ) DECOMPRESSOR="lzmash -d -c" ;;
45 * ) DECOMPRESSOR=cat ;;
46 esac
47 ;;
48 esac
49fi
50 29
51$EXTRACTOR 2>/dev/null | $DECOMPRESSOR 30gz="`echo . | awk '{ printf("%c%c", 0x1f, 0x8b); }'`"
31lzma="`echo . | awk '{ printf("%cLZ", 0xff); }'`"
32xz="`echo . | awk '{ printf("%c7z", 0xfd); }'`"
33case "$comp" in
34 BZh) dd if="$pkg" ibs=$o skip=1 2>/dev/null | bunzip2 ;;
35 "$gz"*) dd if="$pkg" ibs=$o skip=1 2>/dev/null | gunzip ;;
36 "$xz"*) dd if="$pkg" ibs=$o skip=1 2>/dev/null | xzcat ;;
37 "$lzma"*) dd if="$pkg" ibs=$o skip=1 2>/dev/null | unlzma ;;
38 *) echo "Unrecognized rpm file: $pkg"; exit 1 ;;
39esac