On Oct 14, 2007, at 5:43 AM, Anders F Björklund wrote:
> Bernhard Rosenkraenzer wrote:
>
>> $ cvs diff -u -r1.2 -r1.3 rpm2cpio
>> --- rpm/scripts/rpm2cpio 25 May 2007 18:34:16 -0000 1.2
>> +++ rpm/scripts/rpm2cpio 12 Oct 2007 19:50:37 -0000 1.3
>
>> +else
>> + # Most versions of file don't support LZMA, therefore we assume
>> + # anything not detected is LZMA
>> + DECOMPRESSOR="lzmash -d -c"
>> +fi
>> +
>> +dd if=$pkg ibs=$o skip=1 2>/dev/null | $DECOMPRESSOR
>
> Shouldn't this use the new "lzma" command from LZMA Utils 4.32,
> rather than the old "lzmash" shell wrapper script for LZMA SDK ?
> (the old "lzma" command from LZMA Utils 4.27 and/or LZMA SDK has
> now been renamed as "lzma_alone" instead, to avoid name conflicts)
>
(aside) It never ceases to amaze me how much effort
is put into toy scripts like gendiff and rpm2cpio in
order to make them perfect. Scripts are disposable,
just like diapers are.
Here's an alternative rpm2cpio script from PLD:
======================================
#!/bin/sh
pkg=$1
if [ "$pkg" = "" -o ! -e "$pkg" ]; then
echo "no package supplied" 1>&2
exit 1
fi
leadsize=96
o=`expr $leadsize + 8`
set `od -j $o -N 8 -t u1 $pkg`
il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5`
dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9`
# echo "sig il: $il dl: $dl"
sigsize=`expr 8 + 16 \* $il + $dl`
o=`expr $o + $sigsize + \( 8 - \( $sigsize \% 8 \) \) \% 8 + 8`
set `od -j $o -N 8 -t u1 $pkg`
il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5`
dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9`
# echo "hdr il: $il dl: $dl"
hdrsize=`expr 8 + 16 \* $il + $dl`
o=`expr $o + $hdrsize`
comp=$(dd if="$pkg" ibs=$o skip=1 count=1 2>/dev/null \
| dd bs=3 count=1 2> /dev/null)
gz="$(echo -en '\037\0213')"
case "$comp" in
BZh) dd if="$pkg" ibs=$o skip=1 2>/dev/null | bunzip2 ;;
"$gz"*) dd if="$pkg" ibs=$o skip=1 2>/dev/null | gunzip ;;
# no magic in old lzma format, if unknown we assume that's lzma
for now
*) dd if="$pkg" ibs=$o skip=1 2>/dev/null | lzma d -si -
so ;;
#*) echo "Unrecognized rpm file: $pkg"; return 1 ;;
esac
==================================================
Received on Sun Oct 14 16:45:50 2007