From 097e96d6ec6140d386e28905ebbd004809ead87c Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Tue, 27 Mar 2018 17:58:27 +0200 Subject: apache-2.eclass: reflect module dependencies to REQUIRED_USE Portage can do all the checks automatically, with the added bonus that they can get tested with the portage API, which helps e.g. tatt finding out valid combinations of use flags. Closes: https://github.com/gentoo/gentoo/pull/7650 --- eclass/apache-2.eclass | 47 +++++++++++++++++------------------------------ 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/eclass/apache-2.eclass b/eclass/apache-2.eclass index 91ff966c8f13..8eae93fb1d6b 100644 --- a/eclass/apache-2.eclass +++ b/eclass/apache-2.eclass @@ -119,6 +119,23 @@ PDEPEND="~app-admin/apache-tools-${PV}" S="${WORKDIR}/httpd-${PV}" +# @VARIABLE: MODULE_DEPENDS +# @DESCRIPTION: +# This variable needs to be set in the ebuild and contains a space-separated +# list of dependency tokens each with a module and the module it depends on +# separated by a colon + +# now extend REQUIRED_USE to reflect the module dependencies to portage +_apache2_set_module_depends() { + local dep + + for dep in ${MODULE_DEPENDS} ; do + REQUIRED_USE="${REQUIRED_USE} apache2_modules_${dep%:*}? ( apache2_modules_${dep#*:} )" + done +} +_apache2_set_module_depends +unset -f _apache2_set_module_depends + # ============================================================================== # INTERNAL FUNCTIONS # ============================================================================== @@ -207,35 +224,6 @@ check_module_critical() { fi } -# @VARIABLE: MODULE_DEPENDS -# @DESCRIPTION: -# This variable needs to be set in the ebuild and contains a space-separated -# list of dependency tokens each with a module and the module it depends on -# separated by a colon - -# @FUNCTION: check_module_depends -# @DESCRIPTION: -# This internal function makes sure that all inter-module dependencies are -# satisfied with the current module selection -check_module_depends() { - local err=0 - - for m in ${MY_MODS[@]} ; do - for dep in ${MODULE_DEPENDS} ; do - if [[ "${m}" == "${dep%:*}" ]] ; then - if ! use apache2_modules_${dep#*:} ; then - eerror "Module '${m}' depends on '${dep#*:}'" - err=1 - fi - fi - done - done - - if [[ ${err} -ne 0 ]] ; then - die "invalid use flag combination" - fi -} - # @ECLASS-VARIABLE: MY_CONF # @DESCRIPTION: # This internal variable contains the econf options for the current module @@ -316,7 +304,6 @@ setup_modules() { # sort and uniquify MY_MODS MY_MODS=( $(echo ${MY_MODS[@]} | tr ' ' '\n' | sort -u) ) - check_module_depends check_module_critical } -- cgit v1.2.3-65-gdbad