summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Ospald <hasufell@gentoo.org>2013-03-23 21:18:25 +0000
committerJulian Ospald <hasufell@gentoo.org>2013-03-23 21:18:25 +0000
commit998620b295d95be1ba57871dec96cbe027e35e07 (patch)
tree7018a15ec768afde617e8cf5975d3cfc805f68a1 /eclass/unpacker.eclass
parentrestore python-2.7 support (diff)
downloadhistorical-998620b295d95be1ba57871dec96cbe027e35e07.tar.gz
historical-998620b295d95be1ba57871dec96cbe027e35e07.tar.bz2
historical-998620b295d95be1ba57871dec96cbe027e35e07.zip
add unpack_zip function to unpacker.eclass wrt #462612
Diffstat (limited to 'eclass/unpacker.eclass')
-rw-r--r--eclass/unpacker.eclass25
1 files changed, 23 insertions, 2 deletions
diff --git a/eclass/unpacker.eclass b/eclass/unpacker.eclass
index 4be87ce64d4d..8c141dbed140 100644
--- a/eclass/unpacker.eclass
+++ b/eclass/unpacker.eclass
@@ -1,6 +1,6 @@
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v 1.11 2013/03/23 19:35:59 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/unpacker.eclass,v 1.12 2013/03/23 21:18:25 hasufell Exp $
# @ECLASS: unpacker.eclass
# @MAINTAINER:
@@ -299,6 +299,23 @@ unpack_cpio() {
fi
}
+# @FUNCTION: unpack_zip
+# @USAGE: <zip file>
+# @DESCRIPTION:
+# Unpack zip archives.
+# This function ignores all non-fatal errors (i.e. warnings).
+# That is useful for zip archives with extra crap attached
+# (e.g. self-extracting archives).
+unpack_zip() {
+ [[ $# -eq 1 ]] || die "Usage: ${FUNCNAME} <file>"
+
+ local zip=$(find_unpackable_file "$1")
+ unpack_banner "${zip}"
+ unzip -qo "${zip}"
+
+ [[ $? -le 1 ]] || die "unpacking ${zip} failed (arch=unpack_zip)"
+}
+
# @FUNCTION: _unpacker
# @USAGE: <one archive to unpack>
# @INTERNAL
@@ -350,6 +367,8 @@ _unpacker() {
arch="unpack_makeself"
fi
;;
+ *.zip)
+ arch="unpack_zip" ;;
esac
# finally do the unpack
@@ -414,6 +433,8 @@ unpacker_src_uri_depends() {
d="app-arch/p7zip" ;;
*.xz)
d="app-arch/xz-utils" ;;
+ *.zip)
+ d="app-arch/unzip" ;;
esac
deps+=" ${d}"
done