From 313bfae78a1a3e3143fa20b705688f4ec723c47e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Petteri=20R=C3=A4ty?= Date: Sun, 31 Dec 2006 19:30:54 +0000 Subject: [PATCH] Made java-pkg_regjar die if called on a directory and improved debugging information. --- eclass/java-utils-2.eclass | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass index bb57f977bc8a..977e285afd37 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.37 2006/12/31 01:39:38 caster Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.38 2006/12/31 19:30:54 betelgeuse Exp $ # ----------------------------------------------------------------------------- @@ -258,15 +258,15 @@ java-pkg_regjar() { local jar jar_dir jar_file for jar in "$@"; do # TODO use java-pkg_check-versioned-jar - if [[ -e "${jar}" ]]; then + if [[ -e "${jar}" || -e "${D}${jar}" ]]; then + [[ -d "${jar}" || -d "${D}${jar}" ]] \ + && die "Called ${FUNCNAME} on a directory $*" # nelchael: we should strip ${D} in this case too, here's why: # imagine such call: # java-pkg_regjar ${D}/opt/java/*.jar # such call will fall into this case (-e ${jar}) and will # record paths with ${D} in package.env java-pkg_append_ JAVA_PKG_CLASSPATH "${jar#${D}}" - elif [[ -e "${D}${jar}" ]]; then - java-pkg_append_ JAVA_PKG_CLASSPATH "${jar#${D}}" else die "${jar} does not exist" fi @@ -577,7 +577,7 @@ java-pkg_dolauncher() { # Process the other the rest of the arguments while [[ -n "${1}" && -n "${2}" ]]; do - local var=${1} value=${2} + local var="${1}" value="${2}" if [[ "${var:0:2}" == "--" ]]; then local var=${var:2} echo "gjl_${var}=\"${value}\"" >> "${var_tmp}" @@ -801,13 +801,13 @@ java-pkg_jarfrom() { java-pkg_getjars() { debug-print-function ${FUNCNAME} $* - [[ ${#} -lt 1 || ${#} -gt 2 ]] && die "${FUNCNAME} takes only one or two arguments" - if [[ "${1}" = "--build-only" ]]; then local build_only="true" shift fi + [[ ${#} -ne 1 ]] && die "${FUNCNAME} takes only one argument besides --build-only" + local classpath pkgs="${1}" jars="$(java-config --classpath=${pkgs})" [[ -z "${jars}" ]] && die "java-config --classpath=${pkgs} failed" @@ -1439,6 +1439,7 @@ use_doc() { use doc && echo ${@:-javadoc} } + # ------------------------------------------------------------------------------ # @section-end build # ------------------------------------------------------------------------------ @@ -1831,10 +1832,13 @@ java-pkg_get-vm-version() { # Setup the environment for the VM being used. # ------------------------------------------------------------------------------ java-pkg_switch-vm() { + debug-print-function ${FUNCNAME} $* + if java-pkg_needs-vm; then # Use the VM specified by JAVA_PKG_FORCE_VM - if [[ -n ${JAVA_PKG_FORCE_VM} ]]; then + if [[ -n "${JAVA_PKG_FORCE_VM}" ]]; then # If you're forcing the VM, I hope you know what your doing... + debug-print "JAVA_PKG_FORCE_VM used: ${JAVA_PKG_FORCE_VM}" export GENTOO_VM="${JAVA_PKG_FORCE_VM}" # if we're allowed to switch the vm... elif [[ "${JAVA_PKG_ALLOW_VM_CHANGE}" == "yes" ]]; then -- 2.26.2