From 55bc620b7a01365a5aac9ade1039d2c04a097b88 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 17 Feb 2007 00:17:39 +0000 Subject: [PATCH] allow built_with_use to work even with hidden IUSE expanded vars #167166 --- eclass/eutils.eclass | 49 ++++++++++++++++++++++++----------------- eclass/toolchain.eclass | 4 ++-- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass index b820fe399e73..cde8ba217928 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.274 2007/02/17 00:11:42 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.275 2007/02/17 00:17:39 vapier Exp $ # # This eclass is for general purpose functions that most ebuilds # have to implement themselves. @@ -1625,11 +1625,18 @@ preserve_old_lib_notify() { # Usage: built_with_use [--missing ] [-a|-o] # 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) +# --hidden USE flag we're checking is hidden expanded so it isnt in IUSE # Note: the default flag is '-a' built_with_use() { + local hidden="no" + if [[ $1 == "--hidden" ]] ; then + hidden="yes" + shift + fi + local missing_action="die" if [[ $1 == "--missing" ]] ; then missing_action=$2 @@ -1652,7 +1659,7 @@ built_with_use() { # if the IUSE file doesn't exist, the read will error out, we need to handle # this gracefully - if [[ ! -e ${USEFILE} ]] || [[ ! -e ${IUSEFILE} ]] ; then + if [[ ! -e ${USEFILE} ]] || [[ ! -e ${IUSEFILE} && ${hidden} == "no" ]] ; then case ${missing_action} in true) return 0;; false) return 1;; @@ -1660,22 +1667,24 @@ built_with_use() { esac fi - local IUSE_BUILT=$(<${IUSEFILE}) - # Don't check USE_EXPAND #147237 - local expand - for expand in $(echo ${USE_EXPAND} | tr '[:upper:]' '[:lower:]') ; do - if [[ $1 == ${expand}_* ]] ; then - expand="" - break - fi - done - if [[ -n ${expand} ]] ; then - 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 + if [[ ${hidden} == "no" ]] ; then + local IUSE_BUILT=$(<${IUSEFILE}) + # Don't check USE_EXPAND #147237 + local expand + for expand in $(echo ${USE_EXPAND} | tr '[:upper:]' '[:lower:]') ; do + if [[ $1 == ${expand}_* ]] ; then + expand="" + break + fi + done + if [[ -n ${expand} ]] ; then + 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 fi diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index b7b8217133c5..c376a6b30b44 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.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/toolchain.eclass,v 1.325 2007/02/17 00:13:04 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.326 2007/02/17 00:17:39 vapier Exp $ HOMEPAGE="http://gcc.gnu.org/" LICENSE="GPL-2 LGPL-2.1" @@ -1276,7 +1276,7 @@ gcc_do_configure() { if [[ -n ${needed_libc} ]] ; then if ! has_version ${CATEGORY}/${needed_libc} ; then confgcc="${confgcc} --disable-shared --disable-threads --without-headers" - elif built_with_use --missing false ${CATEGORY}/${needed_libc} crosscompile_opts_headers-only ; then + elif built_with_use --hidden --missing false ${CATEGORY}/${needed_libc} crosscompile_opts_headers-only ; then confgcc="${confgcc} --disable-shared --with-sysroot=${PREFIX}/${CTARGET}" else confgcc="${confgcc} --with-sysroot=${PREFIX}/${CTARGET}" -- 2.26.2