diff options
author | Mike Frysinger <vapier@gentoo.org> | 2007-01-19 05:29:18 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2007-01-19 05:29:18 +0000 |
commit | 9534e72880a7d7c1557db944ed625070608b50a8 (patch) | |
tree | 1d574fa477c65030f50300430492f34a72a79d1f /eclass | |
parent | Marked ~hppa (bug #160066). (diff) | |
download | historical-9534e72880a7d7c1557db944ed625070608b50a8.tar.gz historical-9534e72880a7d7c1557db944ed625070608b50a8.tar.bz2 historical-9534e72880a7d7c1557db944ed625070608b50a8.zip |
implement --missing flag for user-control over IUSE-missing behavior
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/eutils.eclass | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass index 57bcfb9b25cc..2d413f185234 100644 --- a/eclass/eutils.eclass +++ b/eclass/eutils.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.268 2007/01/13 19:36:14 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.269 2007/01/19 05:29:18 vapier Exp $ # # This eclass is for general purpose functions that most ebuilds # have to implement themselves. @@ -1592,13 +1592,24 @@ preserve_old_lib_notify() { # Hack for people to figure out if a package was built with # certain USE flags # -# Usage: built_with_use [-a|-o] <DEPEND ATOM> <List of USE flags> +# Usage: built_with_use [--missing <action>] [-a|-o] <DEPEND ATOM> <List of USE flags> # ex: built_with_use xchat gtk2 # -# Flags: -a all USE flags should be utilized -# -o at least one USE flag should be utilized +# Flags: -a all USE flags should be utilized +# -o at least one USE flag should be utilized +# --missing peform the specified action if the flag is not in IUSE (true/false/die) # Note: the default flag is '-a' built_with_use() { + local missing_action="die" + if [[ $1 == "--missing" ]] ; then + missing_action=$2 + shift ; shift + case ${missing_action} in + true|false|die) ;; + *) die "unknown action '${missing_action}'";; + esac + fi + local opt=$1 [[ ${opt:0:1} = "-" ]] && shift || opt="-a" @@ -1623,7 +1634,13 @@ built_with_use() { fi done if [[ -n ${expand} ]] ; then - has $1 ${IUSE_BUILT} || die "$PKG does not actually support the $1 USE flag!" + if ! has $1 ${IUSE_BUILT} ; then + case ${missing_action} in + true) return 0;; + false) return 1;; + die) die "$PKG does not actually support the $1 USE flag!";; + esac + fi fi local USE_BUILT=$(<${USEFILE}) |