diff options
author | Michał Górny <mgorny@gentoo.org> | 2011-09-21 21:46:49 +0000 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2011-09-21 21:46:49 +0000 |
commit | 3b7ae1c81e7004b7ee91de2f3f505c1ed7c732c9 (patch) | |
tree | 0237496c7a1a1ebc85640e311c2bdd488bf6e476 /eclass | |
parent | Also rename macros in new minizip headers. (diff) | |
download | gentoo-2-3b7ae1c81e7004b7ee91de2f3f505c1ed7c732c9.tar.gz gentoo-2-3b7ae1c81e7004b7ee91de2f3f505c1ed7c732c9.tar.bz2 gentoo-2-3b7ae1c81e7004b7ee91de2f3f505c1ed7c732c9.zip |
Introduce in_iuse() for IUSE checks.
Such checks are used at least in autotools-utils & kde* eclasses, and
are done wrong there. Thus, I've created a little reusable snippet
suitable for eutils.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/eutils.eclass | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass index cd1f9ff17cec..d202031b8f98 100644 --- a/eclass/eutils.eclass +++ b/eclass/eutils.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.363 2011/09/12 20:44:01 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.364 2011/09/21 21:46:49 mgorny Exp $ # @ECLASS: eutils.eclass # @MAINTAINER: @@ -2028,3 +2028,20 @@ path_exists() { -o) return $(( r == $# )) ;; esac } + +# @FUNCTION: in_iuse +# @USAGE: <flag> +# @DESCRIPTION: +# Determines whether the given flag is in IUSE. Strips IUSE default prefixes +# as necessary. +# +# Note that this function should not be used in the global scope. +in_iuse() { + debug-print-function ${FUNCNAME} "${@}" + [[ ${#} -eq 1 ]] || die "Invalid args to ${FUNCNAME}()" + + local flag=${1} + local liuse=( ${IUSE} ) + + has "${flag}" "${liuse[@]#[+-]}" +} |