# Eclass for Java packages
#
# Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org>
-# Copyright (c) 2004-2011, Gentoo Foundation
+# Copyright (c) 2004-2015, Gentoo Foundation
#
# Licensed under the GNU General Public License, v2
#
-# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.39 2012/07/21 11:57:30 sera Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v 1.40 2015/04/28 20:35:40 chewi Exp $
# @ECLASS: java-pkg-2.eclass
# @MAINTAINER:
[[ -e "${EANT_BUILD_XML:=build.xml}" ]] || return
if [[ ${EANT_TEST_TARGET} ]] || java-pkg-2_supports-test ${EANT_BUILD_XML}; then
- local opts task
+ local opts task_re junit_re pkg
if [[ ${EANT_TEST_JUNIT_INTO} ]]; then
java-pkg_jar-from --into "${EANT_TEST_JUNIT_INTO}" junit
fi
+ if [[ ${EANT_TEST_GENTOO_CLASSPATH} ]]; then
+ EANT_GENTOO_CLASSPATH="${EANT_TEST_GENTOO_CLASSPATH}"
+ fi
+
ANT_TASKS=${EANT_TEST_ANT_TASKS:-${ANT_TASKS:-${EANT_ANT_TASKS}}}
- if [[ ${DEPEND} = *dev-java/ant-junit* ]]; then
+ task_re="\bdev-java/ant-junit(4)?(-[^:]+)?(:\S+)\b"
+ junit_re="\bdev-java/junit(-[^:]+)?(:\S+)\b"
+
+ if [[ ${DEPEND} =~ ${task_re} ]]; then
+ pkg="ant-junit${BASH_REMATCH[1]}${BASH_REMATCH[3]}"
+ pkg="${pkg%:0}"
if [[ ${ANT_TASKS} && "${ANT_TASKS}" != none ]]; then
- ANT_TASKS="${ANT_TASKS} ant-junit"
+ ANT_TASKS="${ANT_TASKS} ${pkg}"
else
- ANT_TASKS="ant-junit"
+ ANT_TASKS="${pkg}"
fi
+ elif [[ ${DEPEND} =~ ${junit_re} ]]; then
+ pkg="junit${BASH_REMATCH[2]}"
+ pkg="${pkg%:0}"
- task=true
- fi
+ opts="-Djunit.jar=\"$(java-pkg_getjar ${pkg} junit.jar)\""
- if [[ ${task} ]] || [[ ${DEPEND} = *dev-java/junit* ]]; then
- opts="-Djunit.jar=\"$(java-pkg_getjar 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'
+ if [[ ${EANT_GENTOO_CLASSPATH} ]]; then
+ EANT_GENTOO_CLASSPATH+=",${pkg}"
else
- EANT_GENTOO_CLASSPATH=junit
+ EANT_GENTOO_CLASSPATH="${pkg}"
fi
fi
#
# Licensed under the GNU General Public License, v2
#
-# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.158 2015/04/14 14:08:34 chewi Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.159 2015/04/28 20:35:40 chewi Exp $
# @ECLASS: java-utils-2.eclass
# @MAINTAINER:
java-pkg_record-jar_ --build-only "${target_pkg}" "${jar}"
fi
fi
- # otherwise, if the current jar is the target jar, link it
+ # otherwise, if the current jar is the target jar, link it
elif [[ "${jar_name}" == "${target_jar}" ]] ; then
[[ -f "${destjar}" ]] && rm "${destjar}"
ln -snf "${jar}" "${destjar}" \
if [[ -z "${build_only}" ]]; then
java-pkg_record-jar_ "${target_pkg}" "${jar}"
else
- java-pkg_record-jar_ --build-only "${target_jar}" "${jar}"
+ java-pkg_record-jar_ --build-only "${target_pkg}" "${jar}"
fi
fi
popd > /dev/null
# Don't call directly, but via java-pkg-2_pkg_preinst!
java-utils-2_pkg_preinst() {
if is-java-strict; then
+ if [[ ! -e "${JAVA_PKG_ENV}" ]] || has ant-tasks ${INHERITED}; then
+ return
+ fi
+
if has_version dev-java/java-dep-check; then
- [[ -e "${JAVA_PKG_ENV}" ]] || return
local output=$(GENTOO_VM= java-dep-check --image "${D}" "${JAVA_PKG_ENV}")
- if [[ ${output} && has_version <=dev-java/java-dep-check-0.2 ]]; then
- ewarn "Possibly unneeded dependencies found in package.env:"
- for dep in ${output}; do
- ewarn "\t${dep}"
- done
- fi
- if [[ ${output} && has_version >dev-java/java-dep-check-0.2 ]]; then
- ewarn "${output}"
- fi
+ [[ ${output} ]] && ewarn "${output}"
else
eerror "Install dev-java/java-dep-check for dependency checking"
fi
if [[ ${EBUILD_PHASE} = "test" ]]; then
antflags="${antflags} -DJunit.present=true"
- [[ ${ANT_TASKS} = *ant-junit* ]] && gcp="${gcp} junit"
getjarsarg="--with-dependencies"
+
+ local re="\bant-junit4?([-:]\S+)?\b"
+ [[ ${ANT_TASKS} =~ ${re} ]] && gcp+=" ${BASH_REMATCH[0]}"
else
antflags="${antflags} -Dmaven.test.skip=true"
fi
# @INTERNAL
# @DESCRIPTION:
# Check that a package being used in jarfrom, getjars and getjar is contained
-# within DEPEND or RDEPEND.
+# within DEPEND or RDEPEND with the correct SLOT. See this mail for details:
+# https://archives.gentoo.org/gentoo-dev/message/dcb644f89520f4bbb61cc7bbe45fdf6e
# @CODE
# Parameters:
# $1 - empty - check both vars; "runtime" or "build" - check only
# * The target package first has any dots escaped, e.g. foo-1.2
# becomes foo-1\.2.
#
- # * sed then looks at the component following the last - character,
- # or the whole string if there is no - character. It uses this to
- # build a new regexp with two significant branches.
+ # * sed then looks at the component following the last - or :
+ # character, or the whole string if there is no - or :
+ # character. It uses this to build a new regexp with two
+ # significant branches.
#
# * The first checks for the whole target package string, optionally
# followed by a version number, and then :0.
# string, optionally followed by a version number, followed by the
# aforementioned component, treating that as a SLOT.
#
- local stripped_pkg=/$(sed -r 's/-?([^-]+)$/(\0(-[^:]+)?:0|(-[^:]+)?:\1)/' <<< "${target_pkg//./\\.}")\\b
+ local stripped_pkg=/$(sed -r 's/[-:]?([^-:]+)$/(\0(-[^:]+)?:0|(-[^:]+)?:\1)/' <<< "${target_pkg//./\\.}")\\b
debug-print "Matching against: ${stripped_pkg}"
+ # Uncomment the lines below once we've dealt with more of these
+ # otherwise we'll be tempted to turn JAVA_PKG_STRICT off while
+ # getting hit with a wave of bug reports. :(
+
if [[ ${limit_to} != runtime && ! ( "${DEPEND}" =~ $stripped_pkg ) ]]; then
dev_error="The ebuild is attempting to use ${target_pkg}, which is not "
dev_error+="declared with a SLOT in DEPEND."
- if is-java-strict; then
- die "${dev_error}"
- else
- eqawarn "${dev_error}"
- # Uncomment this once we've dealt with more of these or
- # we'll get hit with a wave of bug reports. :(
+# if is-java-strict; then
+# die "${dev_error}"
+# else
+ eqawarn "java-pkg_ensure-dep: ${dev_error}"
# eerror "Because you have ${target_pkg} installed,"
# eerror "the package will build without problems, but please"
# eerror "report this to http://bugs.gentoo.org."
- fi
+# fi
elif [[ ${limit_to} != build && ! ( "${RDEPEND}${PDEPEND}" =~ ${stripped_pkg} ) ]]; then
dev_error="The ebuild is attempting to use ${target_pkg}, which is not "
dev_error+="declared with a SLOT in [RP]DEPEND and --build-only wasn't given."
- if is-java-strict; then
- die "${dev_error}"
- else
- eqawarn "${dev_error}"
- # Uncomment this once we've dealt with more of these or
- # we'll get hit with a wave of bug reports. :(
+# if is-java-strict; then
+# die "${dev_error}"
+# else
+ eqawarn "java-pkg_ensure-dep: ${dev_error}"
# eerror "The package will build without problems, but may fail to run"
# eerror "if you don't have ${target_pkg} installed,"
# eerror "so please report this to http://bugs.gentoo.org."
- fi
+# fi
fi
}