Skip java-dep-check for ant tasks wrt bug #298955. Fix missing
authorJames Le Cuirot <chewi@gentoo.org>
Tue, 28 Apr 2015 20:35:40 +0000 (20:35 +0000)
committerJames Le Cuirot <chewi@gentoo.org>
Tue, 28 Apr 2015 20:35:40 +0000 (20:35 +0000)
ant-core dependency SLOT. Fix recording of BUILD_DEPEND. Fix
java-pkg_ensure-dep matching and adjust the error message. Fix
automatic loading of ant-junit and junit wrt bug #513522 among others.

eclass/ChangeLog
eclass/ant-tasks.eclass
eclass/java-pkg-2.eclass
eclass/java-utils-2.eclass

index 5f04295bce41781a5535dd252576aeea94ef6f0a..94703d61c79943b04d932813cc36158656bc70cf 100644 (file)
@@ -1,6 +1,13 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1596 2015/04/28 14:14:29 kensington Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1597 2015/04/28 20:35:40 chewi Exp $
+
+  28 Apr 2015; James Le Cuirot <chewi@gentoo.org> java-pkg-2.eclass,
+  java-utils-2.eclass, ant-tasks.eclass:
+  Skip java-dep-check for ant tasks wrt bug #298955. Fix missing ant-core
+  dependency SLOT. Fix recording of BUILD_DEPEND. Fix java-pkg_ensure-dep
+  matching and adjust the error message. Fix automatic loading of ant-junit and
+  junit wrt bug #513522 among others.
 
   28 Apr 2015; Michael Palimaka <kensington@gentoo.org> kde4-base.eclass:
   Update SRC_URI.
index f8973f15f3782826c43ec12d2b980d4e187092bd..2887ea83ff1ee20251b97f71ef3f673ce9df94e0 100644 (file)
@@ -1,9 +1,9 @@
 # Eclass for building dev-java/ant-* packages
 #
-# Copyright 1999-2013 Gentoo Foundation
+# Copyright 1999-2015 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.16 2013/10/05 12:07:01 caster Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ant-tasks.eclass,v 1.17 2015/04/28 20:35:40 chewi Exp $
 
 # @ECLASS: ant-tasks.eclass
 # @MAINTAINER:
@@ -98,7 +98,7 @@ SRC_URI="${UPSTREAM_PREFIX}/${MY_P}-src.tar.bz2
 LICENSE="Apache-2.0"
 SLOT="0"
 
-RDEPEND="~dev-java/ant-core-${PV}"
+RDEPEND="~dev-java/ant-core-${PV}:0"
 DEPEND="${RDEPEND}"
 
 if [[ -z "${ANT_TASK_DISABLE_VM_DEPS}" ]]; then
index 592ae80512a3ff9d603b16bae6b48c25adafe1db..366ef6c005c2a99db7f86a010088f41d4d86c35d 100644 (file)
@@ -1,11 +1,11 @@
 # 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:
@@ -123,33 +123,40 @@ 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
+               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
 
index 9aa3da2cae003160757e97e572b953e66f91c684..9ab98bf4ce47bd386792add16ce793fdad7e256a 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.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:
@@ -920,7 +920,7 @@ java-pkg_jar-from() {
                                        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}" \
@@ -929,7 +929,7 @@ java-pkg_jar-from() {
                                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
@@ -1784,18 +1784,13 @@ java-utils-2_src_prepare() {
 # 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
@@ -1909,8 +1904,10 @@ eant() {
 
        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
@@ -2673,7 +2670,8 @@ java-pkg_verify-classes() {
 # @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
@@ -2695,9 +2693,10 @@ java-pkg_ensure-dep() {
        # * 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.
@@ -2706,36 +2705,36 @@ java-pkg_ensure-dep() {
        #   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
 }