public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [RFC] [EAPI=3] Add approprietly prefixed values of IUSE_* variables to IUSE
@ 2009-07-05  2:33 Arfrever Frehtes Taifersar Arahesis
  2009-07-05 11:36 ` David Leverton
  2009-07-05 14:52 ` Ciaran McCreesh
  0 siblings, 2 replies; 4+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2009-07-05  2:33 UTC (permalink / raw
  To: Gentoo Development


[-- Attachment #1.1: Type: text/plain, Size: 710 bytes --]

I would like to suggest that values of IUSE_* variables (whose names end with
values of USE_EXPAND variable), after prefixing with lower-cased names of
appropriate variables included in USE_EXPAND, should be automatically added
to IUSE variable.

Example:
IUSE="abc"
IUSE_LINGUAS="en fr +la pl ru"

Effective IUSE would be "abc linguas_en linguas_fr +linguas_la linguas_pl linguas_ru".

Currently ebuilds need to manually add such flags to IUSE.

It's a zero-cost feature implemented in the attached patch, so including it
in EAPI=3 (after temporary unlocking of list of features of EAPI=3) wouldn't
delay implementing support for EAPI=3 in Portage.

-- 
Arfrever Frehtes Taifersar Arahesis

[-- Attachment #1.2: portage-IUSE_variables.patch --]
[-- Type: text/x-patch, Size: 2412 bytes --]

Index: bin/ebuild.sh
===================================================================
--- bin/ebuild.sh	(revision 13786)
+++ bin/ebuild.sh	(working copy)
@@ -1154,6 +1154,22 @@ debug-print-section() {
 	debug-print "now in section $*"
 }
 
+expand_IUSE() {
+	if ! has "${EAPI:-0}" 0 1 2 ; then
+		local var flag flag_prefix
+		for var in $USE_EXPAND ; do
+			for flag in $(eval echo \$IUSE_$var) ; do
+				flag_prefix=
+				if [[ ${flag:0:1} == [+-] ]] ; then
+					flag_prefix=${flag:0:1}
+					flag=${flag:1}
+				fi
+				IUSE="$IUSE $flag_prefix$(echo $var | LC_ALL=C tr [:upper:] [:lower:])_$flag"
+			done
+		done
+	fi
+}
+
 # Sources all eclasses in parameters
 declare -ix ECLASS_DEPTH=0
 inherit() {
@@ -1240,6 +1256,8 @@ inherit() {
 		#turn off glob expansion
 		set -f
 
+		expand_IUSE
+
 		# If each var has a value, append it to the global variable E_* to
 		# be applied after everything is finished. New incremental behavior.
 		[ "${IUSE-unset}"    != "unset" ] && export E_IUSE="${E_IUSE} ${IUSE}"
@@ -1750,6 +1768,10 @@ _source_ebuild() {
 	# eclasses, they need to be unset before this process of
 	# interaction begins.
 	unset DEPEND RDEPEND PDEPEND IUSE
+	local var
+	for var in $USE_EXPAND ; do
+		unset IUSE_$var
+	done
 	source "${EBUILD}" || die "error sourcing ebuild"
 
 	if [ "${EBUILD_PHASE}" != "depend" ] ; then
@@ -1773,6 +1795,8 @@ _source_ebuild() {
 
 	unset ECLASS E_IUSE E_DEPEND E_RDEPEND E_PDEPEND
 
+	expand_IUSE
+
 	# alphabetically ordered by $EBUILD_PHASE value
 	local f valid_phases
 	case "$EAPI" in
Index: bin/isolated-functions.sh
===================================================================
--- bin/isolated-functions.sh	(revision 13786)
+++ bin/isolated-functions.sh	(working copy)
@@ -512,8 +512,8 @@ save_ebuild_env() {
 			abort_test abort_install dyn_prepare dyn_configure \
 			dyn_compile dyn_test dyn_install \
 			dyn_preinst dyn_help debug-print debug-print-function \
-			debug-print-section inherit EXPORT_FUNCTIONS newdepend newrdepend \
-			newpdepend do_newdepend remove_path_entry \
+			debug-print-section expand_IUSE inherit EXPORT_FUNCTIONS \
+			newdepend newrdepend newpdepend do_newdepend remove_path_entry \
 			save_ebuild_env filter_readonly_variables preprocess_ebuild_env \
 			source_all_bashrcs ebuild_main \
 			ebuild_phase ebuild_phase_with_hooks \

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-07-08  3:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-05  2:33 [gentoo-dev] [RFC] [EAPI=3] Add approprietly prefixed values of IUSE_* variables to IUSE Arfrever Frehtes Taifersar Arahesis
2009-07-05 11:36 ` David Leverton
2009-07-08  3:31   ` Arfrever Frehtes Taifersar Arahesis
2009-07-05 14:52 ` Ciaran McCreesh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox