summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorBertrand Jacquin <bertrand@jacquin.bzh>2015-08-12 01:03:28 +0100
committerBertrand Jacquin <bertrand@jacquin.bzh>2015-08-15 11:55:17 +0100
commit1b85262b33d2791586546f9c67af3f0926a530d0 (patch)
tree3e6f27e36b759e56dbe5e7554e0cc0512c1ceebb /eclass
parentdev-libs/wayland: Version bump (diff)
downloadportage-1b85262b33d2791586546f9c67af3f0926a530d0.tar.xz
dev-db/apache-solr: Popular, blazing fast open source enterprise search platform from the Apache Lucene project
Package-Manager: portage-2.2.20
Diffstat (limited to 'eclass')
-rw-r--r--eclass/java-war.eclass62
1 files changed, 62 insertions, 0 deletions
diff --git a/eclass/java-war.eclass b/eclass/java-war.eclass
new file mode 100644
index 00000000..a5d24f7e
--- /dev/null
+++ b/eclass/java-war.eclass
@@ -0,0 +1,62 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+#
+# Original Author: beber
+# Purpose:
+#
+
+DEPEND="${DEPEND}
+ app-arch/unzip"
+
+JAVA_WAR_UNPACK_DIR="${WORKDIR}/${ECLASS}-unpack"
+
+java-war_src_unpack() {
+ [[ ${#} == 0 ]] && die "${FUNCNAME} need at least one argument"
+
+ mkdir "${JAVA_WAR_UNPACK_DIR}" || die "Failed to create ${JAVA_WAR_UNPACK_DIR}"
+
+ local a
+ while (( $# > 0 )) ; do
+ for a in "${1}" "${S}/${1}" ; do
+ if [[ -e "${a}" ]] ; then
+ break
+ fi
+ done
+
+ if [[ -z "${a}" ]] ; then
+ die "WAR file ${1} does not exist"
+ fi
+
+ local _unpack_dir="${JAVA_WAR_UNPACK_DIR}/${a/#${S}\/}"
+
+ echo ">>> Unpacking ${a/#${S}\/} to ${_unpack_dir}"
+ mkdir -p "${_unpack_dir}" \
+ || die "Failed to create ${_unpack_dir}"
+ unzip -qd "${_unpack_dir}" "${a}" \
+ || die "Failed to unpack ${a}"
+
+ shift
+ done
+}
+
+java-war_src_install() {
+ [[ ${#} == 0 ]] && die "${FUNCNAME} need at least one argument"
+
+ local a
+ while (( $# > 0 )) ; do
+ a="${1}"
+
+ local _unpack_dir="${JAVA_WAR_UNPACK_DIR}/${a/#${S}\/}"
+
+ if [[ ! -d "${_unpack_dir}" ]] ; then
+ die "Unable to find unpacked ${a}"
+ fi
+
+ cd "${_unpack_dir}"
+ doins -r .
+
+ shift
+ done
+}