diff options
author | Petteri Räty <betelgeuse@gentoo.org> | 2008-07-07 16:48:45 +0000 |
---|---|---|
committer | Petteri Räty <betelgeuse@gentoo.org> | 2008-07-07 16:48:45 +0000 |
commit | ca65c1f9b5c3d728ba0dd7be700aabc7c1c0393d (patch) | |
tree | ca9d89e5752ad1697990b6eb51bde3aefcecee4d /eclass | |
parent | Version bump for bug 231062, thanks to Ákos Maróy for reporting. (diff) | |
download | gentoo-2-ca65c1f9b5c3d728ba0dd7be700aabc7c1c0393d.tar.gz gentoo-2-ca65c1f9b5c3d728ba0dd7be700aabc7c1c0393d.tar.bz2 gentoo-2-ca65c1f9b5c3d728ba0dd7be700aabc7c1c0393d.zip |
Always put junit to gentoo.classpath when ANT_TASKS has ant-junit. Fixes bug #225981.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/ant-tasks.eclass | 5 | ||||
-rw-r--r-- | eclass/java-ant-2.eclass | 41 | ||||
-rw-r--r-- | eclass/java-pkg-2.eclass | 58 | ||||
-rw-r--r-- | eclass/java-utils-2.eclass | 4 | ||||
-rw-r--r-- | eclass/java-vm-2.eclass | 104 | ||||
-rw-r--r-- | eclass/pax-utils.eclass | 4 |
6 files changed, 197 insertions, 19 deletions
diff --git a/eclass/ant-tasks.eclass b/eclass/ant-tasks.eclass index b0d4c852e340..cbd57c999bbb 100644 --- a/eclass/ant-tasks.eclass +++ b/eclass/ant-tasks.eclass @@ -3,7 +3,7 @@ # Copyright 2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License, v2 or later # Author Vlastimil Babka <caster@gentoo.org> -# $Header: /var/cvsroot/gentoo-x86/eclass/ant-tasks.eclass,v 1.4 2007/02/02 22:59:53 caster Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ant-tasks.eclass,v 1.5 2008/07/07 16:48:45 betelgeuse Exp $ # we set ant-core dep ourselves, restricted JAVA_ANT_DISABLE_ANT_CORE_DEP=true @@ -103,6 +103,9 @@ DEPEND=">=virtual/jdk-${ANT_TASK_JDKVER} S="${WORKDIR}/${MY_P}" +# Would run the full ant test suite for every ant task +RESTRICT="test" + # ------------------------------------------------------------------------------ # @eclass-src_unpack # diff --git a/eclass/java-ant-2.eclass b/eclass/java-ant-2.eclass index f88f9eea9d26..73e203d66d84 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.36 2008/07/01 19:02:21 betelgeuse Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v 1.37 2008/07/07 16:48:45 betelgeuse Exp $ inherit java-utils-2 @@ -37,7 +37,6 @@ inherit java-utils-2 # dev-java/ant-core into DEPEND. # construct ant-speficic DEPEND -JAVA_ANT_E_DEPEND="" # add ant-core into DEPEND, unless disabled if [[ -z "${JAVA_ANT_DISABLE_ANT_CORE_DEP}" ]]; then JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND} >=dev-java/ant-core-1.7.0" @@ -51,7 +50,15 @@ if [[ $? != 0 ]]; then eerror "${ANT_TASKS_DEPEND}" die "java-pkg_ant-tasks-depend() failed" fi -JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND} ${ANT_TASKS_DEPEND}" + +# We need some tools from javatoolkit. We also need portage 2.1 for phase hooks +# and ant dependencies constructed above. Python is there for +# java-ant_remove-taskdefs +JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND} + ${ANT_TASKS_DEPEND} + ${JAVA_PKG_PORTAGE_DEP} + >=dev-java/javatoolkit-0.2.0-r1 + >=dev-lang/python-2.4" # this eclass must be inherited after java-pkg-2 or java-pkg-opt-2 # if it's java-pkg-opt-2, ant dependencies are pulled based on USE flag @@ -61,9 +68,7 @@ elif ! hasq java-pkg-2 ${INHERITED}; then eerror "java-ant-2 eclass can only be inherited AFTER java-pkg-2 or java-pkg-opt-2" fi -# We need some tools from javatoolkit. We also need portage 2.1 for phase hooks -# and ant dependencies constructed above -DEPEND=">=dev-java/javatoolkit-0.2.0-r1 ${JAVA_PKG_PORTAGE_DEP} ${JAVA_ANT_E_DEPEND}" +DEPEND="${JAVA_ANT_E_DEPEND}" # ------------------------------------------------------------------------------ # @global JAVA_PKG_BSFIX @@ -395,6 +400,30 @@ java-ant_rewrite-classpath() { } # ------------------------------------------------------------------------------ +# @public java-ant_remove-taskdefs +# +# Removes taskdef elements from the file +# @param $1 - the file to rewrite (defaults to build.xml) +# ------------------------------------------------------------------------------ +java-ant_remove-taskdefs() { + debug-print-function ${FUNCNAME} $* + local file=${1:-build.xml} + echo "Removing taskdefs from ${file}" + python <<EOF +import sys +from xml.dom.minidom import parse +dom = parse("${file}") +for elem in dom.getElementsByTagName('taskdef'): + elem.parentNode.removeChild(elem) + elem.unlink() +f = open("${file}", "w") +dom.writexml(f) +f.close() +EOF + [[ $? != 0 ]] && die "Removing taskdefs failed" +} + +# ------------------------------------------------------------------------------ # @public java-ant_ignore-system-classes # # Makes the available task ignore classes in the system classpath diff --git a/eclass/java-pkg-2.eclass b/eclass/java-pkg-2.eclass index 7cdecb26304f..9aa3f9b7f00f 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.26 2008/04/06 16:35:18 betelgeuse Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.27 2008/07/07 16:48:45 betelgeuse Exp $ inherit java-utils-2 @@ -49,7 +49,7 @@ if [[ ${CATEGORY} = dev-java && ${PN} = commons-* ]]; then SRC_URI="mirror://apache/${PN/-///}/source/${P}-src.tar.gz" fi -EXPORT_FUNCTIONS pkg_setup src_compile +EXPORT_FUNCTIONS pkg_setup src_compile src_test # ------------------------------------------------------------------------------ # @eclass-pkg_setup @@ -93,6 +93,60 @@ java-pkg-2_src_compile() { fi } +java-pkg-2_supports-test() { + python << EOF +from xml.dom.minidom import parse +import sys +dom = parse("${1}") +for elem in dom.getElementsByTagName('target'): + if elem.getAttribute('name') == 'test': + sys.exit(0) +sys.exit(1) +EOF + return $? +} + +java-pkg-2_src_test() { + [[ -e "${EANT_BUILD_XML:=build.xml}" ]] || return + + if [[ ${EANT_TEST_TARGET} ]] || java-pkg-2_supports-test ${EANT_BUILD_XML}; then + local opts task + + if [[ ${EANT_TEST_JUNIT_INTO} ]]; then + java-pkg_jar-from --into "${EANT_TEST_JUNIT_INTO}" junit + fi + + ANT_TASKS=${EANT_TEST_ANT_TASKS:-${ANT_TASKS:-${EANT_ANT_TASKS}}} + + if [[ ${DEPEND} = *dev-java/ant-junit* ]]; then + + if [[ ${ANT_TASKS} && "${ANT_TASKS}" != none ]]; then + ANT_TASKS="${ANT_TASKS} ant-junit" + else + ANT_TASKS="ant-junit" + fi + + task=true + fi + + if [[ ${task} ]] || [[ ${DEPEND} = *dev-java/junit* ]]; then + opts="-Djunit.jar=\"$(java-pkg_getjar --build-only junit junit.jar)\"" + if [[ ${EANT_TEST_GENTOO_CLASSPATH} ]]; then + EANT_GENTOO_CLASSPATH="${EANT_TEST_GENTOO_CLASSPATH},junit" + elif [[ ${EANT_GENTOO_CLASSPATH} ]]; then + EANT_GENTOO_CLASSPATH+=',junit' + else + EANT_GENTOO_CLASSPATH=junit + fi + fi + eant ${opts} -f "${EANT_BUILD_XML}" \ + ${EANT_TEST_EXTRA_ARGS} ${EANT_TEST_TARGET:-test} + + else + echo "${FUNCNAME}: No test target in ${EANT_BUILD_XML}" + fi +} + # ------------------------------------------------------------------------------ # @eclass-end # ------------------------------------------------------------------------------ diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass index 2382ecd6f85d..5b777d3b3433 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.108 2008/06/18 10:27:22 ali_bush Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.109 2008/07/07 16:48:45 betelgeuse Exp $ # ----------------------------------------------------------------------------- # @eclass-begin @@ -1918,7 +1918,7 @@ eant() { if [[ ${EBUILD_PHASE} = "test" ]]; then antflags="${antflags} -DJunit.present=true" - [[ ${gcp} && ${ANT_TASKS} = *ant-junit* ]] && gcp="${gcp} junit" + [[ ${ANT_TASKS} = *ant-junit* ]] && gcp="${gcp} junit" getjarsarg="--with-dependencies" fi diff --git a/eclass/java-vm-2.eclass b/eclass/java-vm-2.eclass index 47e067ca7060..bdc28d51b035 100644 --- a/eclass/java-vm-2.eclass +++ b/eclass/java-vm-2.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/java-vm-2.eclass,v 1.20 2008/03/03 17:20:41 betelgeuse Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/java-vm-2.eclass,v 1.21 2008/07/07 16:48:45 betelgeuse Exp $ # ----------------------------------------------------------------------------- # @eclass-begin @@ -26,7 +26,7 @@ export WANT_JAVA_CONFIG=2 JAVA_VM_CONFIG_DIR="/usr/share/java-config-2/vm" JAVA_VM_DIR="/usr/lib/jvm" -EXPORT_FUNCTIONS pkg_setup pkg_postinst pkg_prerm pkg_postrm +EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_prerm pkg_postrm java-vm-2_pkg_setup() { if [[ "${SLOT}" != "0" ]]; then @@ -34,6 +34,85 @@ java-vm-2_pkg_setup() { else VMHANDLE=${PN} fi + debug-print "set VMHANDLE to ${VMHANDLE}" +} + +java-vm_2_src_install() { + local dirs="${JAVA_VM_SUBDIRS:-bin include jre lib man}" + local dest="/opt/${P}" + local ddest="${D}/opt/${P}" + + # Set PaX markings on all JDK/JRE executables to allow code-generation on + # the heap by the JIT compiler. + if hasq hardened $IUSE; then + use hardeded && pax-mark m $(list-paxables ${S}{,/jre}/bin/*) + fi + + cp -pPR $i "${ddest}" || die "failed to copy" + + if [[ -e COPYRIGHT ]]; then + dodoc COPYRIGHT || die + fi + + if [[ -e README.html ]]; then + dohtml README.html || die + fi + + cp -pP src.zip "${D}/opt/${P}/" || die "src.zip doesn't exist" + + if use examples; then + local edest="${ddest}/share" + dodir "${edest}" + cp -pPR demo sample "${edest}" || die + fi + + if hasq jce $IUSE && use jce; then + cd "${ddest}/jre/lib/security" + dodir ${dest}/jre/lib/security/strong-jce + mv "${ddest}/jre/lib/security/US_export_policy.jar" "${ddest}"/jre/lib/security/strong-jce + mv "${ddest}"/jre/lib/security/local_policy.jar \ + "${ddest}/jre/lib/security/strong-jce" + local jcedir=/opt/sun-jce-bin-${JAVA_VM_JCE_VERSION}/jre/lib/security/unlimited-jce + dosym ${jcedir}/US_export_policy.jar ${dest}/jre/lib/security/ || die + dosym ${jcedir}/local_policy.jar ${dest}/jre/lib/security/ || die + fi + + if use nsplugin; then + local plugin_dir="ns7-gcc29" + + if use x86 ; then + install_mozilla_plugin ${dest}/jre/plugin/i386/${plugin_dir}/libjavaplugin_oji.so + else + eerror "No plugin available for amd64 arch" + fi + fi + + # create dir for system preferences + dodir /opt/${P}/jre/.systemPrefs + # Create files used as storage for system preferences. + touch ${D}/opt/${P}/jre/.systemPrefs/.system.lock + chmod 644 ${D}/opt/${P}/jre/.systemPrefs/.system.lock + touch ${D}/opt/${P}/jre/.systemPrefs/.systemRootModFile + chmod 644 ${D}/opt/${P}/jre/.systemPrefs/.systemRootModFile + + if [[ -f ${D}/opt/${P}/jre/plugin/desktop/sun_java.desktop ]]; then + # install control panel for Gnome/KDE + # The jre also installs these so make sure that they do not have the same + # Name + sed -e "s/\(Name=\)Java/\1 Java Control Panel for Sun JDK ${SLOT}/" \ + -e "s#Exec=.*#Exec=/opt/${P}/jre/bin/ControlPanel#" \ + -e "s#Icon=.*#Icon=/opt/${P}/jre/plugin/desktop/sun_java.png#" \ + ${D}/opt/${P}/jre/plugin/desktop/sun_java.desktop > \ + ${T}/sun_jdk-${SLOT}.desktop + + domenu ${T}/sun_jdk-${SLOT}.desktop + fi + + # bug #56444 + insinto /opt/${P}/jre/lib/ + newins "${FILESDIR}"/fontconfig.Gentoo.properties fontconfig.properties + + set_java_env } java-vm-2_pkg_postinst() { @@ -120,15 +199,26 @@ java-vm_set-nsplugin() { } java-vm-2_pkg_prerm() { - if [[ "$(java-config -f 2>/dev/null)" == "${VMHANDLE}" ]]; then - ewarn "It appears you are removing your system-vm!" - ewarn "Please run java-config -L to list available VMs," - ewarn "then use java-config -S to set a new system-vm!" - fi + true # used to have the system vm removing here but can't remove to keep API } java-vm-2_pkg_postrm() { + debug-print-function ${FUNCNAME} "${@}" fdo-mime_desktop_database_update + + atom=${CATEGORY}/${PN} + [[ ${SLOT} != 0 ]] && atom="=${atom}-${SLOT}*" + + if ! has_version ${atom}; then + debug-print "We don't have ${atom} installed so this is not an upgrade." + if [[ "$(java-config -f 2>/dev/null)" == "${VMHANDLE}" ]]; then + ewarn "It appears you are removing your system-vm!" + ewarn "Please run java-config -L to list available VMs," + ewarn "then use java-config -S to set a new system-vm!" + fi + else + elog "We have ${atom} installed." + fi } java_set_default_vm_() { diff --git a/eclass/pax-utils.eclass b/eclass/pax-utils.eclass index 84b60f5def0b..bdbe24f6bbd4 100644 --- a/eclass/pax-utils.eclass +++ b/eclass/pax-utils.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/pax-utils.eclass,v 1.7 2007/05/07 09:24:16 kevquinn Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/pax-utils.eclass,v 1.8 2008/07/07 16:48:45 betelgeuse Exp $ # Author: # Kevin F. Quinn <kevquinn@gentoo.org> @@ -133,6 +133,8 @@ pax-mark() { _pax_list_files elog "$@" scanelf -Xxz ${flags} "$@" elif [[ ${PAX_MARKINGS} != "none" ]]; then + elog "No tool to mark executables found. If you want them marked for" + elog "PaX kernels please install sys-apps/paxctl." # Out of options! failures="$*" fail=1 |