1 |
As suggested by mgorny, we could use bash internals instead of the |
2 |
"has" function calls in global scope. |
3 |
|
4 |
The patch below replaces them by case statements. (Unfortunately we |
5 |
cannot use fall-through (&;) because it is a bash 4 feature.) |
6 |
|
7 |
Ulrich |
8 |
|
9 |
|
10 |
From 89e837f5179354aa3dfa454f51282ad9d1143402 Mon Sep 17 00:00:00 2001 |
11 |
From: =?UTF-8?q?Ulrich=20M=C3=BCller?= <ulm@g.o> |
12 |
Date: Sun, 29 Nov 2015 17:33:08 +0100 |
13 |
Subject: [PATCH] eutils.eclass: In EAPI conditionals, replace "has" by |
14 |
case statements. |
15 |
|
16 |
--- |
17 |
eclass/eutils.eclass | 21 ++++++++++++++------- |
18 |
1 file changed, 14 insertions(+), 7 deletions(-) |
19 |
|
20 |
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass |
21 |
index 5c7d1aa..1163051 100644 |
22 |
--- a/eclass/eutils.eclass |
23 |
+++ b/eclass/eutils.eclass |
24 |
@@ -1614,7 +1614,8 @@ check_license() { |
25 |
die "you no longer need this as portage supports ACCEPT_LICENSE itself" |
26 |
} |
27 |
|
28 |
-if has "${EAPI:-0}" 0 1 2; then |
29 |
+case ${EAPI:-0} in |
30 |
+0|1|2) |
31 |
|
32 |
# @FUNCTION: epause |
33 |
# @USAGE: [seconds] |
34 |
@@ -1646,7 +1647,8 @@ ebeep() { |
35 |
fi |
36 |
} |
37 |
|
38 |
-else |
39 |
+;; |
40 |
+*) |
41 |
|
42 |
ebeep() { |
43 |
ewarn "QA Notice: ebeep is not defined in EAPI=${EAPI}, please file a bug at https://bugs.gentoo.org" |
44 |
@@ -1656,9 +1658,11 @@ epause() { |
45 |
ewarn "QA Notice: epause is not defined in EAPI=${EAPI}, please file a bug at https://bugs.gentoo.org" |
46 |
} |
47 |
|
48 |
-fi |
49 |
+;; |
50 |
+esac |
51 |
|
52 |
-if has "${EAPI:-0}" 0 1 2 3 4; then |
53 |
+case ${EAPI:-0} in |
54 |
+0|1|2|3|4) |
55 |
|
56 |
# @FUNCTION: usex |
57 |
# @USAGE: <USE flag> [true output] [false output] [true suffix] [false suffix] |
58 |
@@ -1669,9 +1673,11 @@ if has "${EAPI:-0}" 0 1 2 3 4; then |
59 |
# otherwise echo [false output][false suffix] (defaults to "no"). |
60 |
usex() { use "$1" && echo "${2-yes}$4" || echo "${3-no}$5" ; } #382963 |
61 |
|
62 |
-fi |
63 |
+;; |
64 |
+esac |
65 |
|
66 |
-if has "${EAPI:-0}" 0 1 2 3 4 5; then |
67 |
+case ${EAPI:-0} in |
68 |
+0|1|2|3|4|5) |
69 |
|
70 |
# @VARIABLE: EPATCH_USER_SOURCE |
71 |
# @DESCRIPTION: |
72 |
@@ -1821,4 +1827,5 @@ in_iuse() { |
73 |
has "${flag}" "${liuse[@]#[+-]}" |
74 |
} |
75 |
|
76 |
-fi |
77 |
+;; |
78 |
+esac |
79 |
-- |
80 |
2.6.3 |