diff options
-rw-r--r-- | eclass/java-ant-2.eclass | 29 | ||||
-rw-r--r-- | eclass/java-pkg-2.eclass | 46 | ||||
-rw-r--r-- | eclass/java-pkg-opt-2.eclass | 45 | ||||
-rw-r--r-- | eclass/java-utils-2.eclass | 50 |
4 files changed, 49 insertions, 121 deletions
diff --git a/eclass/java-ant-2.eclass b/eclass/java-ant-2.eclass index 2cb890077caa..84a06bc2beb1 100644 --- a/eclass/java-ant-2.eclass +++ b/eclass/java-ant-2.eclass @@ -14,7 +14,7 @@ # # Licensed under the GNU General Public License, v2 # -# $Header: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v 1.22 2007/06/01 12:49:03 betelgeuse Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v 1.23 2007/08/05 08:17:05 betelgeuse Exp $ inherit java-utils-2 @@ -126,33 +126,12 @@ JAVA_PKG_BSFIX_TARGET_TAGS=${JAVA_PKG_BSFIX_TARGET_TAGS:-"javac xjavac javac.pre JAVA_PKG_BSFIX_SOURCE_TAGS=${JAVA_PKG_BSFIX_SOURCE_TAGS:-"javadoc javac xjavac javac.preset"} # ------------------------------------------------------------------------------ -# @public java-ant_src_unpack +# @global JAVA_ANT_IGNORE_SYSTEM_CLASSES # -# Unpacks the source, and attempts to fix build files. -# variable JAVA_ANT_IGNORE_SYSTEM_CLASSES: -# ignore ant classpath in available tasks -# ------------------------------------------------------------------------------ -post_src_unpack() { - if java-pkg_func-exists ant_src_unpack; then - die "ant_src_unpack is no longer support, should use just src_unpack" - fi - java-ant_bsfix - [[ "${JAVA_ANT_IGNORE_SYSTEM_CLASSES}" ]] \ - && java-ant_ignore-system-classes "${S}/build.xml" -} - -# ------------------------------------------------------------------------------ -# @private ant_src_unpack +# Rewrites available tasks to ignore ant classpath. # -# Helper function which does the actual unpacking +# default: off # ------------------------------------------------------------------------------ -# TODO maybe use base.eclass for some patching love? -#ant_src_unpack() { -# debug-print-function ${FUNCNAME} $* -# if [[ -n "${A}" ]]; then -# unpack ${A} -# fi -#} # ------------------------------------------------------------------------------ # @private java-ant_bsfix diff --git a/eclass/java-pkg-2.eclass b/eclass/java-pkg-2.eclass index 00fde92c3d5f..76b438c4c620 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.23 2007/05/17 21:04:43 caster Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.24 2007/08/05 08:17:05 betelgeuse Exp $ inherit java-utils-2 @@ -89,49 +89,5 @@ java-pkg-2_src_compile() { } # ------------------------------------------------------------------------------ -# @note -# -# We need to initialize the environment in every function because Portage -# will source /etc/profile between phases and trample all over the env. -# This is accomplished by phase hooks, which is available with newer versions of -# portage. -# ------------------------------------------------------------------------------ - -pre_pkg_setup() { - java-pkg-2_pkg_setup -} - -pre_src_unpack() { - java-pkg-2_pkg_setup -} - -pre_src_compile() { - if is-java-strict; then - echo "Searching for bundled jars:" - java-pkg_find-normal-jars || echo "None found." - echo "Searching for bundled classes (no output if none found):" - find "${WORKDIR}" -name "*.class" - echo "Search done." - fi - java-pkg-2_pkg_setup -} - -pre_src_install() { - java-pkg-2_pkg_setup -} - -pre_src_test() { - java-pkg-2_pkg_setup -} - -pre_pkg_preinst() { - java-pkg-2_pkg_setup -} - -pre_pkg_postinst() { - java-pkg-2_pkg_setup -} - -# ------------------------------------------------------------------------------ # @eclass-end # ------------------------------------------------------------------------------ diff --git a/eclass/java-pkg-opt-2.eclass b/eclass/java-pkg-opt-2.eclass index e6ef94cf4a1c..a98fb2ed94e0 100644 --- a/eclass/java-pkg-opt-2.eclass +++ b/eclass/java-pkg-opt-2.eclass @@ -5,7 +5,12 @@ # # Licensed under the GNU General Public License, v2 # -# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-opt-2.eclass,v 1.5 2006/12/03 13:05:06 betelgeuse Exp $ +# Major changes: +# 20070855: +# Removed phase hooks because Portage does proper env saving now. +# <betelgeuse@gentoo.org> +# +# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-opt-2.eclass,v 1.6 2007/08/05 08:17:05 betelgeuse Exp $ inherit java-utils-2 @@ -37,41 +42,3 @@ EXPORT_FUNCTIONS pkg_setup java-pkg-opt-2_pkg_setup() { use ${JAVA_PKG_OPT_USE} && java-pkg_init } - -# ------------------------------------------------------------------------------ -# @note -# -# We need to initialize the environment in every function because Portage -# will source /etc/profile between phases and trample all over the env. -# This is accomplished by phase hooks, which is available with newer versions of -# portage. -# ------------------------------------------------------------------------------ - -pre_pkg_setup() { - java-pkg-opt-2_pkg_setup -} - -pre_src_unpack() { - java-pkg-opt-2_pkg_setup - use "${JAVA_PKG_OPT_USE}" || JAVA_PKG_BSFIX="off" -} - -pre_src_compile() { - java-pkg-opt-2_pkg_setup -} - -pre_src_install() { - java-pkg-opt-2_pkg_setup -} - -pre_src_test() { - java-pkg-opt-2_pkg_setup -} - -pre_pkg_preinst() { - java-pkg-opt-2_pkg_setup -} - -pre_pkg_postinst() { - java-pkg-opt-2_pkg_setup -} diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass index e2169504f97f..9b3606a950eb 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.91 2007/07/20 18:36:02 betelgeuse Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.92 2007/08/05 08:17:05 betelgeuse Exp $ # ----------------------------------------------------------------------------- # @eclass-begin @@ -59,10 +59,11 @@ export WANT_JAVA_CONFIG="2" # ----------------------------------------------------------------------------- # @variable-internal JAVA_PKG_PORTAGE_DEP # -# The version of portage we need to function properly. At this moment it's -# portage with phase hooks support. +# The version of portage we need to function properly. Previously it was +# portage with phase hooks support but now we use a version with proper env +# saving. # ----------------------------------------------------------------------------- -JAVA_PKG_PORTAGE_DEP=">=sys-apps/portage-2.1_pre1" +JAVA_PKG_PORTAGE_DEP=">=sys-apps/portage-2.1.2.7" # ----------------------------------------------------------------------------- # @variable-internal JAVA_PKG_E_DEPEND @@ -1781,11 +1782,36 @@ ejunit() { # EANT_GENTOO_CLASSPATH - calls java-pkg_getjars for the value and adds to the # gentoo.classpath property. Be sure to call # java-ant_rewrite-classpath in src_unpack. +# JAVA_PKG_NO_BUNDLED_SEARCH - Don't search for bundled jars or class files # *ANT_TASKS - used to determine ANT_TASKS before calling Ant. # ------------------------------------------------------------------------------ eant() { debug-print-function ${FUNCNAME} $* + if [[ ${EBUILD_PHASE} = compile ]]; then + # Used to be done in hooks in java-ant-2.eclass but moved here so that we can + # finally get rid of the hooks without breaking stuff + + [[ "${JAVA_ANT_IGNORE_SYSTEM_CLASSES}" && "${JAVA_PKG_BSFIX}" ]] \ + && java-ant_ignore-system-classes "${S}/build.xml" + + if hasq java-ant-2 ${INHERITED}; then + java-ant_bsfix + fi + + # eant can be called multiple times + JAVA_PKG_BSFIX="off" + + if [[ -z ${JAVA_PKG_NO_BUNDLED_SEARCH} ]] && is-java-strict; then + echo "Searching for bundled jars:" + java-pkg_find-normal-jars || echo "None found." + echo "Searching for bundled classes (no output if none found):" + find "${WORKDIR}" -name "*.class" + echo "Search done." + JAVA_PKG_NO_BUNDLED_SEARCH=true # eant can be called many times + fi + fi + if ! hasq java-ant-2 ${INHERITED}; then local msg="You should inherit java-ant-2 when using eant" java-pkg_announce-qa-violation "${msg}" @@ -1797,7 +1823,6 @@ eant() { local compiler="${GENTOO_COMPILER}" local compiler_env="${JAVA_PKG_COMPILER_DIR}/${compiler}" - local build_compiler="$(source ${compiler_env} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER})" if [[ "${compiler}" != "javac" && -z "${build_compiler}" ]]; then die "ANT_BUILD_COMPILER undefined in ${compiler_env}" @@ -2018,6 +2043,10 @@ java-pkg_init() { I_WANT_GLOBAL_JAVA_OPTIONS="true" fi + if java-pkg_func-exists ant_src_unpack; then + java-pkg_announce-qa-violation "Using old ant_src_unpack. Should be src_unpack" + fi + java-pkg_init_paths_ java-pkg_switch-vm PATH=${JAVA_HOME}/bin:${PATH} @@ -2464,14 +2493,11 @@ java-pkg_switch-vm() { java-pkg_append_ LD_LIBRARY_PATH "$(java-config -g LDPATH)" local tann="${T}/announced-vm" + # With the hooks we should only get here once from pkg_setup but better safe than sorry + # if people have for example modified eclasses some where if [[ -n "${JAVA_PKG_DEBUG}" ]] || [[ ! -f "${tann}" ]] ; then - # Add a check for setup/preinst phase... to avoid duplicate outputs - # for when FEATURES=buildpkg - if [[ ${EBUILD_PHASE} != "setup" && ${EBUILD_PHASE} != "preinst" && ${EBUILD_PHASE} != "postinst" ]]; - then - einfo "Using: $(java-config -f)" - [[ ! -f "${tann}" ]] && touch "${tann}" - fi + einfo "Using: $(java-config -f)" + [[ ! -f "${tann}" ]] && touch "${tann}" fi else |