Added to code to automatically show possible bundled jars in pre_src_compile.
authorPetteri Räty <betelgeuse@gentoo.org>
Wed, 10 Jan 2007 09:52:51 +0000 (09:52 +0000)
committerPetteri Räty <betelgeuse@gentoo.org>
Wed, 10 Jan 2007 09:52:51 +0000 (09:52 +0000)
eclass/java-pkg-2.eclass
eclass/java-utils-2.eclass

index ddce6ca1c44c166fc62591a43a1abb8fda7a82c0..99f3843ccd4a45db6d7131eabe07cf8a0e4553e1 100644 (file)
@@ -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
 }
 
index 6f0eff9eebac79e53b5e74fe3cde3e5f62981784..d8093fbb1ca8e13d3c475e770f72248cfd12a022 100644 (file)
@@ -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
 }
 
 # ------------------------------------------------------------------------------