Consider SLOTs when checking Java dependencies. Comment out the longer
authorJames Le Cuirot <chewi@gentoo.org>
Tue, 14 Apr 2015 14:08:34 +0000 (14:08 +0000)
committerJames Le Cuirot <chewi@gentoo.org>
Tue, 14 Apr 2015 14:08:34 +0000 (14:08 +0000)
error message for now to avoid spamming both users and ourselves
because this issue is currently widespread.

eclass/ChangeLog
eclass/java-utils-2.eclass

index 27bf020adade439bc524af119f22c0e8c78d2354..4e0ba548430d69453fb7c3608264f02c44c51a65 100644 (file)
@@ -1,6 +1,11 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1586 2015/04/11 17:11:22 kensington Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1587 2015/04/14 14:08:34 chewi Exp $
+
+  14 Apr 2015; James Le Cuirot <chewi@gentoo.org> java-utils-2.eclass:
+  Consider SLOTs when checking Java dependencies. Comment out the longer error
+  message for now to avoid spamming both users and ourselves because this issue
+  is currently widespread.
 
   11 Apr 2015; Michael Palimaka <kensington@gentoo.org> kde5-functions.eclass,
   kde5.eclass:
index 52a62ecad530a9998b83eb2e192b638452334e5f..9aa3da2cae003160757e97e572b953e66f91c684 100644 (file)
@@ -2,11 +2,11 @@
 #
 # Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org>
 # Copyright (c) 2004, Karl Trygve Kalleberg <karltk@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-utils-2.eclass,v 1.157 2015/04/04 21:04:49 chewi Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.158 2015/04/14 14:08:34 chewi Exp $
 
 # @ECLASS: java-utils-2.eclass
 # @MAINTAINER:
@@ -2687,42 +2687,54 @@ java-pkg_ensure-dep() {
        local target_pkg="${2}"
        local dev_error=""
 
-       # remove the version specification, which may include globbing (* and [123])
-       local stripped_pkg=$(echo "${target_pkg}" | sed \
-               's/-\([0-9*]*\(\[[0-9]*\]\)*\)*\(\.\([0-9*]*\(\[[0-9]*\]\)*\)*\)*$//')
+       # Transform into a regular expression to look for a matching package
+       # and SLOT. SLOTs don't have to be numeric so foo-bar could either
+       # mean foo-bar:0 or foo:bar. So you want to get your head around the
+       # line below?
+       #
+       # * 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.
+       #
+       # * The first checks for the whole target package string, optionally
+       #   followed by a version number, and then :0.
+       #
+       # * The second checks for the first part of the target package
+       #   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
 
        debug-print "Matching against: ${stripped_pkg}"
 
-       if [[ ${limit_to} != runtime && ! ( "${DEPEND}" =~ "$stripped_pkg" ) ]]; then
-               dev_error="The ebuild is attempting to use ${target_pkg} that is not"
-               dev_error="${dev_error} declared in DEPEND."
+       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
-                       eerror "${dev_error}"
                        die "${dev_error}"
-               elif [[ ${BASH_SUBSHELL} = 0 ]]; then
-                       eerror "${dev_error}"
-                       elog "Because you have this package installed the package will"
-                       elog "build without problems, but please report this to"
-                       elog "http://bugs.gentoo.org"
+               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. :(
+#                      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
-
-       if [[ ${limit_to} != build ]]; then
-               if [[ ! ( ${RDEPEND} =~ "${stripped_pkg}" ) ]]; then
-                       if [[ ! ( ${PDEPEND} =~ "${stripped_pkg}" ) ]]; then
-                               dev_error="The ebuild is attempting to use ${target_pkg},"
-                               dev_error="${dev_error} without specifying --build-only, that is not declared in RDEPEND"
-                               dev_error="${dev_error} or PDEPEND."
-                               if is-java-strict; then
-                                       eerror "${dev_error}"
-                                       die "${dev_error}"
-                               elif [[ ${BASH_SUBSHELL} = 0 ]]; then
-                                       eerror "${dev_error}"
-                                       elog "The package will build without problems, but may fail to run"
-                                       elog "if you don't have ${target_pkg} installed, so please report"
-                                       elog "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. :(
+#                      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
 }