From 75983f32c74fef479eb9cfc62a361fb663379aa5 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Tue, 14 Apr 2015 14:08:34 +0000 Subject: [PATCH] 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. --- eclass/ChangeLog | 7 +++- eclass/java-utils-2.eclass | 76 ++++++++++++++++++++++---------------- 2 files changed, 50 insertions(+), 33 deletions(-) diff --git a/eclass/ChangeLog b/eclass/ChangeLog index 27bf020adade..4e0ba548430d 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -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 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 kde5-functions.eclass, kde5.eclass: diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass index 52a62ecad530..9aa3da2cae00 100644 --- a/eclass/java-utils-2.eclass +++ b/eclass/java-utils-2.eclass @@ -2,11 +2,11 @@ # # Copyright (c) 2004-2005, Thomas Matthijs # Copyright (c) 2004, Karl Trygve Kalleberg -# 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 } -- 2.26.2