1 |
commit: b9e2daded3663c59bf11b04e952bdfb4eb5deabf |
2 |
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Aug 31 14:24:09 2012 +0000 |
4 |
Commit: Ulrich Mueller <ulm <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Aug 31 14:46:45 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b9e2dade |
7 |
|
8 |
EAPI 5: usex helper function |
9 |
|
10 |
See bug #382963. |
11 |
|
12 |
--- |
13 |
bin/ebuild.sh | 2 +- |
14 |
bin/phase-helpers.sh | 14 ++++++++++++++ |
15 |
bin/save-ebuild-env.sh | 5 +++++ |
16 |
3 files changed, 20 insertions(+), 1 deletions(-) |
17 |
|
18 |
diff --git a/bin/ebuild.sh b/bin/ebuild.sh |
19 |
index d3ca9d9..51e90d7 100755 |
20 |
--- a/bin/ebuild.sh |
21 |
+++ b/bin/ebuild.sh |
22 |
@@ -33,7 +33,7 @@ else |
23 |
done |
24 |
# These dummy functions return false in older EAPIs, in order to ensure that |
25 |
# `use multislot` is false for the "depend" phase. |
26 |
- for x in use useq usev ; do |
27 |
+ for x in use useq usev usex ; do |
28 |
eval "${x}() { |
29 |
if has \"\${EAPI:-0}\" 4-python; then |
30 |
die \"\${FUNCNAME}() calls are not allowed in global scope\" |
31 |
|
32 |
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh |
33 |
index 6899488..5f170fc 100644 |
34 |
--- a/bin/phase-helpers.sh |
35 |
+++ b/bin/phase-helpers.sh |
36 |
@@ -174,6 +174,20 @@ usev() { |
37 |
return 1 |
38 |
} |
39 |
|
40 |
+case ${EAPI} in |
41 |
+ 0|1|2|3|4) ;; |
42 |
+ *) |
43 |
+ usex() { |
44 |
+ if use "$1"; then |
45 |
+ echo "${2-yes}$4" |
46 |
+ else |
47 |
+ echo "${3-no}$5" |
48 |
+ fi |
49 |
+ return 0 |
50 |
+ } |
51 |
+ ;; |
52 |
+esac |
53 |
+ |
54 |
use() { |
55 |
local u=$1 |
56 |
local found=0 |
57 |
|
58 |
diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh |
59 |
index 4bf6e4e..a6d1c61 100644 |
60 |
--- a/bin/save-ebuild-env.sh |
61 |
+++ b/bin/save-ebuild-env.sh |
62 |
@@ -73,6 +73,11 @@ save_ebuild_env() { |
63 |
_hasg _hasgq _unpack_tar \ |
64 |
${QA_INTERCEPTORS} |
65 |
|
66 |
+ case ${EAPI} in |
67 |
+ 0|1|2|3|4) ;; |
68 |
+ *) unset -f usex ;; |
69 |
+ esac |
70 |
+ |
71 |
# portage config variables and variables set directly by portage |
72 |
unset ACCEPT_LICENSE BAD BRACKET BUILD_PREFIX COLS \ |
73 |
DISTCC_DIR DISTDIR DOC_SYMLINKS_DIR \ |