summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2007-01-19 05:29:18 +0000
committerMike Frysinger <vapier@gentoo.org>2007-01-19 05:29:18 +0000
commit460abd6fd8ffb41aee13b904b99b233516f0b60d (patch)
treeb2bfe264f69f68d0b905364db238dbc5c15348aa /eclass
parentMarked ~hppa (bug #160066). (diff)
downloadgentoo-2-460abd6fd8ffb41aee13b904b99b233516f0b60d.tar.gz
gentoo-2-460abd6fd8ffb41aee13b904b99b233516f0b60d.tar.bz2
gentoo-2-460abd6fd8ffb41aee13b904b99b233516f0b60d.zip
implement --missing flag for user-control over IUSE-missing behavior
Diffstat (limited to 'eclass')
-rw-r--r--eclass/eutils.eclass27
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})