From 13fc94ddb77e55d3082110114739aade739c54c2 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 7 Dec 2004 01:32:01 +0000 Subject: [PATCH] built_with_use() --- eclass/eutils.eclass | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass index 73ffb49d36f9..38f8755bf06a 100644 --- a/eclass/eutils.eclass +++ b/eclass/eutils.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.124 2004/11/13 11:15:33 usata Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.125 2004/12/07 01:32:01 vapier Exp $ # # Author: Martin Schlemmer # @@ -1515,3 +1515,23 @@ preserve_old_lib_notify() { einfo "Note: 'emerge gentoolkit' to get revdep-rebuild" fi } + +# Hack for people to figure out if a package was built with +# certain USE flags +# +# Usage: built_with_use +# ex: built_with_use xchat gtk2 +built_with_use() { + local PKG=$(portageq best_version ${ROOT} $1) + local USEFILE="${ROOT}/var/db/pkg/${PKG}/USE" + [[ ! -e ${USEFILE} ]] && return 1 + + local USE_BUILT=$(<${USEFILE}) + + shift + while [ $# -gt 0 ] ; do + has $1 ${USE_BUILT} || return 1 + shift + done + return 0 +} -- 2.26.2