Gentoo Archives: gentoo-dev

From: Doug Freed <dwfreed@×××.edu>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH 1/5] depend.apache.eclass: Replace build_with_use with has_version
Date: Fri, 09 Dec 2016 07:05:37
Message-Id: CAFyXEp+zCUieAAdB52FMScoA-PqqcBF7bRLre2E+OgbyQOfY_g@mail.gmail.com
In Reply to: Re: [gentoo-dev] [PATCH 1/5] depend.apache.eclass: Replace build_with_use with has_version by "Michał Górny"
1 On Fri, Dec 9, 2016 at 1:09 AM, Michał Górny <mgorny@g.o> wrote:
2 > On Thu, 8 Dec 2016 21:36:28 +0100
3 > Andreas K. Hüttel <dilfridge@g.o> wrote:
4 >
5 >> From: Doug Freed <dwfreed@×××.edu>
6 >>
7 >> ---
8 >> eclass/depend.apache.eclass | 6 +++---
9 >> 1 file changed, 3 insertions(+), 3 deletions(-)
10 >>
11 >> diff --git a/eclass/depend.apache.eclass b/eclass/depend.apache.eclass
12 >> index b69c2ec..a7d206f 100644
13 >> --- a/eclass/depend.apache.eclass
14 >> +++ b/eclass/depend.apache.eclass
15 >> @@ -290,7 +290,7 @@ has_apache() {
16 >> has_apache_threads() {
17 >> debug-print-function $FUNCNAME $*
18 >>
19 >> - if ! built_with_use www-servers/apache threads; then
20 >> + if ! has_version 'www-servers/apache[threads]'; then
21 >> return
22 >> fi
23 >>
24 >> @@ -313,14 +313,14 @@ has_apache_threads() {
25 >> has_apache_threads_in() {
26 >> debug-print-function $FUNCNAME $*
27 >>
28 >> - if ! built_with_use www-servers/apache threads; then
29 >> + if ! has_version 'www-servers/apache[threads]'; then
30 >> return
31 >> fi
32 >>
33 >> local myforeign="$1"
34 >> local myflag="${2:-threads}"
35 >>
36 >> - if ! built_with_use ${myforeign} ${myflag}; then
37 >> + if ! has_version "${myforeign}[${myflag}]"; then
38 >> echo
39 >> eerror "You need to enable USE flag '${myflag}' in ${myforeign} to"
40 >> eerror "build a thread-safe version of ${CATEGORY}/${PN} for use"
41 >
42 > I don't think it's valid for EAPI 0/1. You should probably move the
43 > EAPI 1 ban first, to avoid keeping half-broken state between commits,
44 > and add an explicit die call here for EAPI 0. It's better if ebuild
45 > dies with explanation rather than unreliably fails with invalid
46 > has_version syntax.
47
48 Correct, USE dependencies don't exist until EAPI 2 (which is why
49 people used built_with_use instead of has_version). This is why I
50 banned both EAPI 0 and 1 in my version of the patch. There are
51 presently 19 EAPI 0 consumers of this eclass, though.
52
53 -Doug