extract_distfiles(): recognize .tar.xz distfiles, reorganize code.

--HG--
extra : convert_revision : 18cc1457f76ddbaadfec8557ab36bd2a67bcff03
This commit is contained in:
Juan RP 2009-12-13 13:38:53 +01:00
parent 7f7ec10f8d
commit 780381e8ae
1 changed files with 25 additions and 28 deletions

View File

@ -84,23 +84,27 @@ extract_distfiles()
curfile=$(basename $f) curfile=$(basename $f)
if $(echo $f|grep -q '.tar.lzma'); then if $(echo $f|grep -q '.tar.lzma'); then
cursufx=".tar.lzma" cursufx="txz"
elif $(echo $f|grep -q '.tar.xz'); then
cursufx="txz"
elif $(echo $f|grep -q '.txz'); then
cursufx="txz"
elif $(echo $f|grep -q '.tar.bz2'); then elif $(echo $f|grep -q '.tar.bz2'); then
cursufx=".tar.bz2" cursufx="tbz"
elif $(echo $f|grep -q '.tbz'); then elif $(echo $f|grep -q '.tbz'); then
cursufx=".tbz" cursufx="tbz"
elif $(echo $f|grep -q '.tar.gz'); then elif $(echo $f|grep -q '.tar.gz'); then
cursufx=".tar.gz" cursufx="tgz"
elif $(echo $f|grep -q '.tgz'); then elif $(echo $f|grep -q '.tgz'); then
cursufx=".tgz" cursufx="tgz"
elif $(echo $f|grep -q '.gz'); then elif $(echo $f|grep -q '.gz'); then
cursufx=".gz" cursufx="gz"
elif $(echo $f|grep -q '.bz2'); then elif $(echo $f|grep -q '.bz2'); then
cursufx=".bz2" cursufx="bz2"
elif $(echo $f|grep -q '.tar'); then elif $(echo $f|grep -q '.tar'); then
cursufx=".tar" cursufx="tar"
elif $(echo $f|grep -q '.zip'); then elif $(echo $f|grep -q '.zip'); then
cursufx=".zip" cursufx="zip"
else else
msg_error "unknown distfile suffix for $curfile." msg_error "unknown distfile suffix for $curfile."
fi fi
@ -113,35 +117,28 @@ extract_distfiles()
fi fi
case ${cursufx} in case ${cursufx} in
.tar.lzma) txz)
if [ -x $XBPS_MASTERDIR/usr/bin/lzma ]; then if [ ! -x $XBPS_MASTERDIR/usr/bin/xz ]; then
cp -f $XBPS_SRCDISTDIR/$curfile $lwrksrc msg_error "cannot find xz for extraction."
cd $lwrksrc && \ fi
$XBPS_MASTERDIR/usr/bin/lzma \ $ltar_cmd xfJ $XBPS_SRCDISTDIR/$curfile -C $lwrksrc
-d $curfile && \ if [ $? -ne 0 ]; then
$ltar_cmd xf ${curfile%.lzma} \ msg_error "extracting $curfile into $lwrksrc."
-C $lwrksrc && \
rm -f ${curfile%.lzma}
if [ $? -ne 0 ]; then
msg_error "extracting $curfile into $lwrksrc."
fi
else
msg_error "cannot find lzma bin for extraction."
fi fi
;; ;;
.tar.bz2|.tbz) tbz)
$ltar_cmd xfj $XBPS_SRCDISTDIR/$curfile -C $lwrksrc $ltar_cmd xfj $XBPS_SRCDISTDIR/$curfile -C $lwrksrc
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "extracting $curfile into $lwrksrc." msg_error "extracting $curfile into $lwrksrc."
fi fi
;; ;;
.tar.gz|.tgz) tgz)
$ltar_cmd xfz $XBPS_SRCDISTDIR/$curfile -C $lwrksrc $ltar_cmd xfz $XBPS_SRCDISTDIR/$curfile -C $lwrksrc
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "extracting $curfile into $lwrksrc." msg_error "extracting $curfile into $lwrksrc."
fi fi
;; ;;
.gz|.bz2) gz|bz2)
cp -f $XBPS_SRCDISTDIR/$curfile $lwrksrc cp -f $XBPS_SRCDISTDIR/$curfile $lwrksrc
if [ "$cursufx" = ".gz" ]; then if [ "$cursufx" = ".gz" ]; then
cd $lwrksrc && gunzip $curfile cd $lwrksrc && gunzip $curfile
@ -149,13 +146,13 @@ extract_distfiles()
cd $lwrksrc && bunzip2 $curfile cd $lwrksrc && bunzip2 $curfile
fi fi
;; ;;
.tar) tar)
$ltar_cmd xf $XBPS_SRCDISTDIR/$curfile -C $lwrksrc $ltar_cmd xf $XBPS_SRCDISTDIR/$curfile -C $lwrksrc
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "extracting $curfile into $lwrksrc." msg_error "extracting $curfile into $lwrksrc."
fi fi
;; ;;
.zip) zip)
if [ -x $XBPS_MASTERDIR/usr/bin/unzip ]; then if [ -x $XBPS_MASTERDIR/usr/bin/unzip ]; then
$XBPS_MASTERDIR/usr/bin/unzip \ $XBPS_MASTERDIR/usr/bin/unzip \
-q -x $XBPS_SRCDISTDIR/$curfile -d $lwrksrc -q -x $XBPS_SRCDISTDIR/$curfile -d $lwrksrc