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
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: signature.asc
Description: This is a digitally signed message part.

Reply via email to