summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-02-16 00:02:43 +0000
committerMike Frysinger <vapier@gentoo.org>2009-02-16 00:02:43 +0000
commit861fb716b306db698b7a4357e2cd6866658ab5f5 (patch)
tree7d903a4baa07d0d55e7bbad8897f81acfe777412
parent5ab45d760b1450f3d875cf012ef28e9f833ea2dc (diff)
downloadportage-861fb716b306db698b7a4357e2cd6866658ab5f5.tar.gz
portage-861fb716b306db698b7a4357e2cd6866658ab5f5.tar.bz2
portage-861fb716b306db698b7a4357e2cd6866658ab5f5.zip
unify code for unpacking of tar files
svn path=/main/trunk/; revision=12620
-rwxr-xr-xbin/ebuild.sh36
1 files changed, 13 insertions, 23 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 032cd3ad2..65684b05f 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -353,6 +353,15 @@ unpack() {
fi
[[ ! -s ${srcdir}${x} ]] && die "${x} does not exist"
+ _unpack_tar() {
+ if [ "${y}" == "tar" ]; then
+ $1 -dc "${srcdir}${x}" | tar xof - ${tar_opts}
+ assert "$myfail"
+ else
+ $1 -dc "${srcdir}${x}" > ${x%.*} || die "$myfail"
+ fi
+ }
+
myfail="failure unpacking ${x}"
case "${x##*.}" in
tar)
@@ -369,19 +378,10 @@ unpack() {
unzip -qo "${srcdir}${x}" || die "$myfail"
;;
gz|Z|z)
- if [ "${y}" == "tar" ]; then
- tar zoxf "${srcdir}${x}" ${tar_opts} || die "$myfail"
- else
- gzip -dc "${srcdir}${x}" > ${x%.*} || die "$myfail"
- fi
+ _unpack_tar gzip
;;
bz2|bz)
- if [ "${y}" == "tar" ]; then
- bzip2 -dc "${srcdir}${x}" | tar xof - ${tar_opts}
- assert "$myfail"
- else
- bzip2 -dc "${srcdir}${x}" > ${x%.*} || die "$myfail"
- fi
+ _unpack_tar bzip2
;;
7Z|7z)
local my_output
@@ -428,23 +428,13 @@ unpack() {
fi
;;
lzma)
- if [ "${y}" == "tar" ]; then
- lzma -dc "${srcdir}${x}" | tar xof - ${tar_opts}
- assert "$myfail"
- else
- lzma -dc "${srcdir}${x}" > ${x%.*} || die "$myfail"
- fi
+ _unpack_tar lzma
;;
xz)
if hasq $eapi 0 1 2 ; then
vecho "unpack ${x}: file format not recognized. Ignoring."
else
- if [ "${y}" == "tar" ]; then
- xz -dc "${srcdir}${x}" | tar xof - ${tar_opts}
- assert "$myfail"
- else
- xz -dc "${srcdir}${x}" > ${x%.*} || die "$myfail"
- fi
+ _unpack_tar xz
fi
;;
*)