common/hooks/do-extract: support 'xbps-uhelper fetch's new '>'-destfile syntax; replace if/elif by case struct for choosing extract method.

This commit is contained in:
Enno Boland 2014-03-12 16:43:37 +01:00
parent ab3000ee6c
commit 3ea159d359
1 changed files with 16 additions and 27 deletions

View File

@ -11,7 +11,7 @@ hook() {
# Check that distfiles are there before anything else. # Check that distfiles are there before anything else.
for f in ${distfiles}; do for f in ${distfiles}; do
curfile=$(basename $f) curfile=$(basename "${f#*>}")
if [ ! -f $srcdir/$curfile ]; then if [ ! -f $srcdir/$curfile ]; then
msg_error "$pkgver: cannot find ${curfile}, use 'xbps-src fetch' first.\n" msg_error "$pkgver: cannot find ${curfile}, use 'xbps-src fetch' first.\n"
fi fi
@ -24,7 +24,7 @@ hook() {
msg_normal "$pkgver: extracting distfile(s), please wait...\n" msg_normal "$pkgver: extracting distfile(s), please wait...\n"
for f in ${distfiles}; do for f in ${distfiles}; do
curfile=$(basename $f) curfile=$(basename "${f#*>}")
for j in ${skip_extraction}; do for j in ${skip_extraction}; do
if [ "$curfile" = "$j" ]; then if [ "$curfile" = "$j" ]; then
found=1 found=1
@ -36,31 +36,20 @@ hook() {
continue continue
fi fi
if $(echo $f|grep -q '.tar.lzma'); then case $curfile in
cursufx="txz" *.tar.lzma) cursufx="txz";;
elif $(echo $f|grep -q '.tar.xz'); then *.tar.xz) cursufx="txz";;
cursufx="txz" *.txz) cursufx="txz";;
elif $(echo $f|grep -q '.txz'); then *.tar.bz2) cursufx="tbz";;
cursufx="txz" *.tbz) cursufx="tbz";;
elif $(echo $f|grep -q '.tar.bz2'); then *.tar.gz) cursufx="tgz";;
cursufx="tbz" *.tgz) cursufx="tgz";;
elif $(echo $f|grep -q '.tbz'); then *.gz) cursufx="gz";;
cursufx="tbz" *.bz2) cursufx="bz2";;
elif $(echo $f|grep -q '.tar.gz'); then *.tar) cursufx="tar";;
cursufx="tgz" *.zip) cursufx="zip";;
elif $(echo $f|grep -q '.tgz'); then *) msg_error "$pkgver: unknown distfile suffix for $curfile.\n";;
cursufx="tgz" esac
elif $(echo $f|grep -q '.gz'); then
cursufx="gz"
elif $(echo $f|grep -q '.bz2'); then
cursufx="bz2"
elif $(echo $f|grep -q '.tar'); then
cursufx="tar"
elif $(echo $f|grep -q '.zip'); then
cursufx="zip"
else
msg_error "$pkgver: unknown distfile suffix for $curfile.\n"
fi
if [ -n "$create_wrksrc" ]; then if [ -n "$create_wrksrc" ]; then
extractdir="$wrksrc" extractdir="$wrksrc"