From 1b85262b33d2791586546f9c67af3f0926a530d0 Mon Sep 17 00:00:00 2001 From: Bertrand Jacquin Date: Wed, 12 Aug 2015 01:03:28 +0100 Subject: dev-db/apache-solr: Popular, blazing fast open source enterprise search platform from the Apache Lucene project Package-Manager: portage-2.2.20 --- eclass/java-war.eclass | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 eclass/java-war.eclass (limited to 'eclass') 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 +} -- cgit v1.2.3