From: Petteri Räty Date: Wed, 10 Jan 2007 09:52:51 +0000 (+0000) Subject: Added to code to automatically show possible bundled jars in pre_src_compile. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c1b340daae57b9cf6bb78184881a346c2b4a378d;p=gentoo.git Added to code to automatically show possible bundled jars in pre_src_compile. --- diff --git a/eclass/java-pkg-2.eclass b/eclass/java-pkg-2.eclass index ddce6ca1c44c..99f3843ccd4a 100644 --- a/eclass/java-pkg-2.eclass +++ b/eclass/java-pkg-2.eclass @@ -5,7 +5,7 @@ # # Licensed under the GNU General Public License, v2 # -# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.8 2006/12/18 10:18:56 betelgeuse Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.9 2007/01/10 09:52:51 betelgeuse Exp $ inherit java-utils-2 @@ -84,6 +84,10 @@ pre_src_unpack() { } pre_src_compile() { + if is-java-strict; then + echo "Searching for bundled jars:" + java-pkg_find-normal-jars || echo "None found." + fi java-pkg-2_pkg_setup } diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass index 6f0eff9eebac..d8093fbb1ca8 100644 --- a/eclass/java-utils-2.eclass +++ b/eclass/java-utils-2.eclass @@ -6,7 +6,7 @@ # # Licensed under the GNU General Public License, v2 # -# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.39 2007/01/03 09:18:20 caster Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.40 2007/01/10 09:52:51 betelgeuse Exp $ # ----------------------------------------------------------------------------- @@ -1011,13 +1011,36 @@ java-pkg_getjar() { # export RDEPEND="${RDEPEND} ${depstr}" #} -# This should be used after S has been populated with symlinks to jars -# TODO document +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_find-normal-jars +# +# Find the files with suffix .jar file in the given directory or $WORKDIR +# +# @param $1 - The directory to search for jar files (default: ${WORKDIR}) +# ------------------------------------------------------------------------------ +java-pkg_find-normal-jars() { + local dir=$1 + [[ "${dir}" ]] || dir="${WORKDIR}" + local found + for jar in $(find "${dir}" -name "*.jar" -type f); do + echo "${jar}" + found="true" + done + [[ "${found}" ]] + return $? +} + +# ------------------------------------------------------------------------------ +# @ebuild-function java-pkg_ensure-no-bundled-jars +# +# Try to locate bundled jar files in ${WORKDIR} and die if found. +# This function should be called after WORKDIR has been populated with symlink +# to system jar files or bundled jars removed. +# ------------------------------------------------------------------------------ java-pkg_ensure-no-bundled-jars() { debug-print-function ${FUNCNAME} $* - pushd ${WORKDIR} >/dev/null 2>/dev/null - local bundled_jars=$(find . -name "*.jar" -type f) + local bundled_jars=$(java-pkg_find-normal-jars) if [[ -n ${bundled_jars} ]]; then echo "Bundled jars found:" local jar @@ -1025,9 +1048,7 @@ java-pkg_ensure-no-bundled-jars() { echo $(pwd)${jar/./} done die "Bundled jars found!" - fi - popd >/dev/null 2>/dev/null } # ------------------------------------------------------------------------------