Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH 14/18] Add tentative EAPI6 in_iuse() function
Date: Mon, 01 Dec 2014 21:30:55
Message-Id: 1417469316-25052-15-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH 00/18] Updated EAPI 6 patch set by "Michał Górny"
1 Add a function to query IUSE_EFFECTIVE for flags.
2 ---
3 bin/eapi.sh | 4 ++++
4 bin/phase-helpers.sh | 16 ++++++++++++++++
5 2 files changed, 20 insertions(+)
6
7 diff --git a/bin/eapi.sh b/bin/eapi.sh
8 index c650a4c..e0ade02 100644
9 --- a/bin/eapi.sh
10 +++ b/bin/eapi.sh
11 @@ -80,6 +80,10 @@ ___eapi_has_eapply_user() {
12 [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
13 }
14
15 +___eapi_has_in_iuse() {
16 + [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
17 +}
18 +
19 ___eapi_has_master_repositories() {
20 [[ ${1-${EAPI}} =~ ^(5-progress)$ ]]
21 }
22 diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
23 index a6e1cdb..e2376bf 100644
24 --- a/bin/phase-helpers.sh
25 +++ b/bin/phase-helpers.sh
26 @@ -1036,6 +1036,22 @@ if ___eapi_has_eapply_user; then
27 }
28 fi
29
30 +if ___eapi_has_in_iuse; then
31 + in_iuse() {
32 + local use=${1}
33 +
34 + if [[ -z "${use}" ]]; then
35 + echo "!!! in_iuse() called without a parameter." >&2
36 + echo "!!! in_iuse <USEFLAG>" >&2
37 + die "in_iuse() called without a parameter"
38 + fi
39 +
40 + local liuse=( ${IUSE_EFFECTIVE} )
41 +
42 + has "${use}" "${liuse[@]#[+-]}"
43 + }
44 +fi
45 +
46 if ___eapi_has_master_repositories; then
47 master_repositories() {
48 local output repository=$1 retval
49 --
50 2.1.3