| 1 | # Copyright 1999-2011 Gentoo Foundation |
1 | # Copyright 1999-2011 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.363 2011/09/12 20:44:01 mgorny Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.364 2011/09/21 21:46:49 mgorny Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: eutils.eclass |
5 | # @ECLASS: eutils.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # base-system@gentoo.org |
7 | # base-system@gentoo.org |
| 8 | # @BLURB: many extra (but common) functions that are used in ebuilds |
8 | # @BLURB: many extra (but common) functions that are used in ebuilds |
| … | |
… | |
| 2026 | case ${opt} in |
2026 | case ${opt} in |
| 2027 | -a) return $(( r != 0 )) ;; |
2027 | -a) return $(( r != 0 )) ;; |
| 2028 | -o) return $(( r == $# )) ;; |
2028 | -o) return $(( r == $# )) ;; |
| 2029 | esac |
2029 | esac |
| 2030 | } |
2030 | } |
|
|
2031 | |
|
|
2032 | # @FUNCTION: in_iuse |
|
|
2033 | # @USAGE: <flag> |
|
|
2034 | # @DESCRIPTION: |
|
|
2035 | # Determines whether the given flag is in IUSE. Strips IUSE default prefixes |
|
|
2036 | # as necessary. |
|
|
2037 | # |
|
|
2038 | # Note that this function should not be used in the global scope. |
|
|
2039 | in_iuse() { |
|
|
2040 | debug-print-function ${FUNCNAME} "${@}" |
|
|
2041 | [[ ${#} -eq 1 ]] || die "Invalid args to ${FUNCNAME}()" |
|
|
2042 | |
|
|
2043 | local flag=${1} |
|
|
2044 | local liuse=( ${IUSE} ) |
|
|
2045 | |
|
|
2046 | has "${flag}" "${liuse[@]#[+-]}" |
|
|
2047 | } |