1 |
commit: 097e96d6ec6140d386e28905ebbd004809ead87c |
2 |
Author: Rolf Eike Beer <eike <AT> sf-mail <DOT> de> |
3 |
AuthorDate: Tue Mar 27 15:58:27 2018 +0000 |
4 |
Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Apr 27 14:01:22 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=097e96d6 |
7 |
|
8 |
apache-2.eclass: reflect module dependencies to REQUIRED_USE |
9 |
|
10 |
Portage can do all the checks automatically, with the added bonus that they can |
11 |
get tested with the portage API, which helps e.g. tatt finding out valid |
12 |
combinations of use flags. |
13 |
Closes: https://github.com/gentoo/gentoo/pull/7650 |
14 |
|
15 |
eclass/apache-2.eclass | 47 +++++++++++++++++------------------------------ |
16 |
1 file changed, 17 insertions(+), 30 deletions(-) |
17 |
|
18 |
diff --git a/eclass/apache-2.eclass b/eclass/apache-2.eclass |
19 |
index 91ff966c8f1..8eae93fb1d6 100644 |
20 |
--- a/eclass/apache-2.eclass |
21 |
+++ b/eclass/apache-2.eclass |
22 |
@@ -119,6 +119,23 @@ PDEPEND="~app-admin/apache-tools-${PV}" |
23 |
|
24 |
S="${WORKDIR}/httpd-${PV}" |
25 |
|
26 |
+# @VARIABLE: MODULE_DEPENDS |
27 |
+# @DESCRIPTION: |
28 |
+# This variable needs to be set in the ebuild and contains a space-separated |
29 |
+# list of dependency tokens each with a module and the module it depends on |
30 |
+# separated by a colon |
31 |
+ |
32 |
+# now extend REQUIRED_USE to reflect the module dependencies to portage |
33 |
+_apache2_set_module_depends() { |
34 |
+ local dep |
35 |
+ |
36 |
+ for dep in ${MODULE_DEPENDS} ; do |
37 |
+ REQUIRED_USE="${REQUIRED_USE} apache2_modules_${dep%:*}? ( apache2_modules_${dep#*:} )" |
38 |
+ done |
39 |
+} |
40 |
+_apache2_set_module_depends |
41 |
+unset -f _apache2_set_module_depends |
42 |
+ |
43 |
# ============================================================================== |
44 |
# INTERNAL FUNCTIONS |
45 |
# ============================================================================== |
46 |
@@ -207,35 +224,6 @@ check_module_critical() { |
47 |
fi |
48 |
} |
49 |
|
50 |
-# @VARIABLE: MODULE_DEPENDS |
51 |
-# @DESCRIPTION: |
52 |
-# This variable needs to be set in the ebuild and contains a space-separated |
53 |
-# list of dependency tokens each with a module and the module it depends on |
54 |
-# separated by a colon |
55 |
- |
56 |
-# @FUNCTION: check_module_depends |
57 |
-# @DESCRIPTION: |
58 |
-# This internal function makes sure that all inter-module dependencies are |
59 |
-# satisfied with the current module selection |
60 |
-check_module_depends() { |
61 |
- local err=0 |
62 |
- |
63 |
- for m in ${MY_MODS[@]} ; do |
64 |
- for dep in ${MODULE_DEPENDS} ; do |
65 |
- if [[ "${m}" == "${dep%:*}" ]] ; then |
66 |
- if ! use apache2_modules_${dep#*:} ; then |
67 |
- eerror "Module '${m}' depends on '${dep#*:}'" |
68 |
- err=1 |
69 |
- fi |
70 |
- fi |
71 |
- done |
72 |
- done |
73 |
- |
74 |
- if [[ ${err} -ne 0 ]] ; then |
75 |
- die "invalid use flag combination" |
76 |
- fi |
77 |
-} |
78 |
- |
79 |
# @ECLASS-VARIABLE: MY_CONF |
80 |
# @DESCRIPTION: |
81 |
# This internal variable contains the econf options for the current module |
82 |
@@ -316,7 +304,6 @@ setup_modules() { |
83 |
|
84 |
# sort and uniquify MY_MODS |
85 |
MY_MODS=( $(echo ${MY_MODS[@]} | tr ' ' '\n' | sort -u) ) |
86 |
- check_module_depends |
87 |
check_module_critical |
88 |
} |