summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorBrian Harring <ferringb@gentoo.org>2005-08-30 04:07:00 +0000
committerBrian Harring <ferringb@gentoo.org>2005-08-30 04:07:00 +0000
commita4d23cb368ec1c4478b882e9e45ee1ce46408c92 (patch)
tree4c62e6713402435c3b14104208f47f988615bbd9 /bin
parentMigration (without history) of the current stable line to subversion. (diff)
downloadportage-multirepo-a4d23cb368ec1c4478b882e9e45ee1ce46408c92.tar.gz
portage-multirepo-a4d23cb368ec1c4478b882e9e45ee1ce46408c92.tar.bz2
portage-multirepo-a4d23cb368ec1c4478b882e9e45ee1ce46408c92.zip
re-adding the unpack function to stable someone yanked... :)
svn path=/main/branches/2.0/; revision=1947
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ebuild.sh59
1 files changed, 59 insertions, 0 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 3271859e..1783b83c 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -335,6 +335,65 @@ keepdir()
fi
}
+unpack() {
+ local x
+ local y
+ local myfail
+ local tarvars
+
+ if [ "$USERLAND" == "BSD" ]; then
+ tarvars=""
+ else
+ tarvars="--no-same-owner"
+ fi
+
+ [ -z "$*" ] && die "Nothing passed to the 'unpack' command"
+
+ for x in "$@"; do
+ myfail="failure unpacking ${x}"
+ echo ">>> Unpacking ${x} to $(pwd)"
+ y="${x%.*}"
+ y="${y##*.}"
+
+ case "${x##*.}" in
+ tar)
+ tar xf "${DISTDIR}/${x}" ${tarvars} || die "$myfail"
+ ;;
+ tgz)
+ tar xzf "${DISTDIR}/${x}" ${tarvars} || die "$myfail"
+ ;;
+ tbz2)
+ bzip2 -dc "${DISTDIR}/${x}" | tar xf - ${tarvars}
+ assert "$myfail"
+ ;;
+ ZIP|zip)
+ unzip -qo "${DISTDIR}/${x}" || die "$myfail"
+ ;;
+ gz|Z|z)
+ if [ "${y}" == "tar" ]; then
+ tar xzf "${DISTDIR}/${x}" ${tarvars} || die "$myfail"
+ else
+ gzip -dc "${DISTDIR}/${x}" > ${x%.*} || die "$myfail"
+ fi
+ ;;
+ bz2)
+ if [ "${y}" == "tar" ]; then
+ bzip2 -dc "${DISTDIR}/${x}" | tar xf - ${tarvars}
+ assert "$myfail"
+ else
+ bzip2 -dc "${DISTDIR}/${x}" > ${x%.*} || die "$myfail"
+ fi
+ ;;
+ RAR|rar)
+ unrar x -idq "${DISTDIR}/${x}" || die "$myfail"
+ ;;
+ *)
+ echo "unpack ${x}: file format not recognized. Ignoring."
+ ;;
+ esac
+ done
+}
+
strip_duplicate_slashes () {
if [ -n "${1}" ]; then
local removed="${1/\/\///}"