public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sven Eden" <sven.eden@gmx.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/ufed:master commit in: /
Date: Fri, 15 Feb 2013 08:36:46 +0000 (UTC)	[thread overview]
Message-ID: <1360913911.5210deeb7d6c8f4cca79b37a9aae22147216a9ac.yamakuzure@gentoo> (raw)

commit:     5210deeb7d6c8f4cca79b37a9aae22147216a9ac
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Fri Feb 15 07:38:31 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Feb 15 07:38:31 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=5210deeb

Make more use of the USE_ORDER content from make.globals. It now allows to have package default settings (IUSE) being overridden by make.defaults.

---
 Portage.pm |  118 +++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 74 insertions(+), 44 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 0e758bf..9130a37 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -49,6 +49,8 @@ our $used_make_conf = "";
 my %_environment  = ();
 my $_EPREFIX        = "";
 my @_profiles     = ();
+my %_use_order    = ();
+
 # $_use_temp - hashref that represents the current state of
 # all known flags. This is for data gathering, the public
 # $use_flags is generated out of this by _gen_use_flags()
@@ -88,7 +90,7 @@ sub _determine_eprefix;
 sub _determine_make_conf;
 sub _determine_profiles;
 sub _final_cleaning;
-sub _fix_descriptions;
+sub _fix_flags;
 sub _gen_use_flags;
 sub _merge;
 sub _merge_env;
@@ -99,6 +101,7 @@ sub _read_descriptions;
 sub _read_make_conf;
 sub _read_make_defaults;
 sub _read_make_globals;
+sub _read_package_use;
 sub _read_packages;
 sub _read_sh;
 sub _read_use_force;
@@ -112,30 +115,43 @@ INIT {
 	_determine_make_conf;
 	_determine_profiles;
 	_read_make_globals;
-	_read_make_conf; ## Needed first to know about overlays
 
-	# Now with the defaults loaded, a check is in order
-	# whether the set USE_ORDER is supported:
+	# make.conf is loaded first to parse for the set overlays
+	# directories, if any. USE flags from make.conf get a
+	# dedicated area {conf}, so there is no harm in loading
+	# it first.
+	_read_make_conf;
+
+	# USE_ORDER must not only be defined, it sets the order in which settings
+	# are loaded overriding each other.
 	defined($_environment{USE_ORDER})
 		or die("Unable to determine USE_ORDER!\nSomething is seriously broken!\n");
-	my $lastorder = "";
+	my $ordNr  = 0;
 	my @use_order = reverse split /:/, $_environment{USE_ORDER};
 	for my $order(@use_order) {
-		$lastorder = $order
-			if( ($order eq 'defaults') || ($order eq 'conf') );
+		"env"         eq $order and next; ## Not used by ufed
+		"pkg"         eq $order and _read_package_use;
+		# "conf" is already loaded
+		"defaults"    eq $order and _read_make_defaults;
+		"pkginternal" eq $order and _read_packages;
+		"repo"        eq $order and next; ## Done in "defaults" and "pkginternal" in the right order
+		"env.d"       eq $order and next; ## Not used by ufed
+		$_use_order{$order} = ++$ordNr;
+	}
+	if ( !defined($_use_order{"defaults"})
+	  || !defined($_use_order{"conf"})
+	  || ($_use_order{"defaults"} > $_use_order{"conf"})) {
+		die("Sorry, USE_ORDER without make.conf overriding global"
+		  . " USE flags are not currently supported by ufed.\n");
 	}
-	$lastorder eq 'conf'
-		or die("Sorry, USE_ORDER without make.conf overriding global"
-			. " USE flags are not currently supported by ufed.\n");
 
-	_read_make_defaults;
-	_read_packages;
+	# Now the rest can be read	
 	_read_use_force; ## Must be before _read_use_mask to not
 	_read_use_mask;  ## unintentionally unmask explicitly masked flags.
 	_read_archs;
 	_read_descriptions;
 	_remove_expands;
-	_fix_descriptions;
+	_fix_flags;
 	_final_cleaning;
 	_gen_use_flags;
 }
@@ -296,24 +312,30 @@ sub _final_cleaning
 }
 
 
-# All flags that are specific to explicit versioning have no
-# descriptions yet. This must be enriched from the versionless
-# package setting.
-# Further flags that have no proper description get the
-# string "(Unknown)" as a description
-sub _fix_descriptions
+# This function fixes two aspects of the temporary flag hash:
+# A) The {"default"} flag settings of packages might have to be
+#    overridden by the {"global"} ones.
+#    (see USE_ORDER in man make.conf)
+# B) All flags that are specific to explicit versioning have no
+#    descriptions yet. This must be enriched from the versionless
+#    package setting.
+# C) Further flags that have no proper description get the
+#    string "(Unknown)" as a description
+sub _fix_flags
 {
 	for my $flag (keys %{$_use_temp}) {
 		my $flagRef  = $_use_temp->{$flag}; ## Shortcut
 		my $globRef  = $flagRef->{global}  || undef;
 		my $locaRef  = $flagRef->{"local"} || undef;
 		my $gDesc    = "(Unknown)";
+		my $gDefault = 0;
 		my $hasLocal = 0;
 
 		# check global part first
 		if (defined($globRef)) {
 			if (length($globRef->{descr})) {
-				$gDesc = $globRef->{descr};
+				$gDesc    = $globRef->{descr};
+				$gDefault = $globRef->{"default"};
 			} elsif ( $globRef->{conf}
 				   || $globRef->{"default"}
 				   || $globRef->{forcded}
@@ -327,7 +349,15 @@ sub _fix_descriptions
 		for my $pkg (sort keys %$locaRef) {
 			$hasLocal = 1;
 			
-			# No action required if a description is present
+			# fix {default} settings if a global one is set
+			# This is make.defaults overriding IUSE settings.
+			if ( $gDefault
+			  && ( !defined($_use_order{"pkginternal"})
+			    || ($_use_order{"defaults"} > $_use_order{"pkginternal"})) ) {
+				$locaRef->{$pkg}{"default"} = $gDefault;
+			}
+
+			# No further action required if a description is present
 			next if (length($locaRef->{$pkg}{descr}));
 			
 			# Otherwise check wether this is worth to be added
@@ -613,8 +643,8 @@ sub _read_make_conf {
 }
 
 
-# read all found make.defaults and package.use files and merge
-# their values into env, adding flag parameters to $_use_tmp.
+# read all found make.defaults merge their values into env,
+# adding flag parameters to $_use_tmp.
 # TODO : use USE_EXPAND to add Expansion parsing. The most
 #        important of these are set with sane defaults here,
 #        too.
@@ -637,20 +667,32 @@ sub _read_make_defaults {
 		}
 	} ## End of reading make.defaults
 
-	# package.use files are parsed next, finished by /etc/portage/package.use
+	return;
+}
+
+
+# read all found make.globals and merge their
+# settings into %environment. This is done to
+# get the final "PORTDIR" and "USE_ORDER"
+# No parameters accepted
+sub _read_make_globals {
+	for my $dir(@_profiles, "${_EPREFIX}/usr/share/portage/config") {
+		_read_sh("$dir/make.globals");
+	}
+	return;
+}
+
+
+# read all found package.use files and merge their values into
+# env, adding flag parameters to $_use_tmp.
+# No parameters accepted.
+sub _read_package_use
+{
 	for my $dir(@_profiles, "${_EPREFIX}/etc/portage") {
 		my $tgt = $dir eq "${_EPREFIX}/etc/portage" ? "pkguse" : "package";
 		for(_noncomments("$dir/package.use") ) {
 			my($pkg, @flags) = split;
 			
-			# There is an important detail: package.use files can limit
-			# their settings to specific package versions.
-			# As ufed is showing a generalized view and can in no
-			# acceptable way determine which versions are relevant,
-			# we have to *skip* all settings that have specific version
-			# and/or slot information limiting their scope.
-# CHECK			$pkg =~ /^[<>=~]/ and next;
-			
 			for my $flag (@flags) {
 				my $state = $flag =~ s/^-// || 0;
 
@@ -666,18 +708,6 @@ sub _read_make_defaults {
 		}
 	} ## End of reading package.use
 
-	return
-}
-
-
-# read all found make.globals and merge their
-# settings into %environment. This is done to
-# get the final "PORTDIR" and "USE_ORDER"
-# No parameters accepted
-sub _read_make_globals {
-	for my $dir(@_profiles, "${_EPREFIX}/usr/share/portage/config") {
-		_read_sh("$dir/make.globals");
-	}
 	return;
 }
 


             reply	other threads:[~2013-02-15  8:36 UTC|newest]

Thread overview: 238+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-15  8:36 Sven Eden [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-11-07 14:25 [gentoo-commits] proj/ufed:master commit in: / Sven Eden
2020-05-02  8:38 Ulrich Müller
2019-09-27  6:42 Sven Eden
2019-09-27  6:39 Sven Eden
2019-09-24 17:57 Sven Eden
2019-09-24 17:56 Sven Eden
2019-04-07 15:17 David Seifert
2019-04-07 13:56 David Seifert
2019-04-07 13:19 David Seifert
2019-04-07 13:19 David Seifert
2019-04-07 13:19 David Seifert
2019-04-07 13:19 David Seifert
2019-04-07 13:19 David Seifert
2015-02-12 15:47 Sven Eden
2015-02-11  9:03 Sven Eden
2014-11-10  9:59 Sven Eden
2014-10-28 11:43 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-25  8:18 Sven Eden
2014-02-25  8:18 Sven Eden
2014-02-25  8:18 Sven Eden
2014-02-25  8:18 Sven Eden
2013-11-25 21:43 Sven Eden
2013-11-25 21:43 Sven Eden
2013-11-25 21:43 Sven Eden
2013-11-25 21:43 Sven Eden
2013-11-25 21:43 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-11  7:09 Sven Eden
2013-09-11  6:31 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-10 12:37 Sven Eden
2013-09-10  6:36 Sven Eden
2013-09-10  6:36 Sven Eden
2013-09-10  6:36 Sven Eden
2013-09-10  6:36 Sven Eden
2013-09-10  6:36 Sven Eden
2013-09-10  6:36 Sven Eden
2013-09-10  6:36 Sven Eden
2013-07-22  9:34 Sven Eden
2013-07-22  6:09 Sven Eden
2013-07-22  6:09 Sven Eden
2013-04-09  7:22 Sven Eden
2013-04-09  7:22 Sven Eden
2013-04-09  7:22 Sven Eden
2013-04-08  7:18 Sven Eden
2013-04-03 13:39 Sven Eden
2013-03-05 16:53 Sven Eden
2013-03-05 16:49 Sven Eden
2013-03-05 16:49 Sven Eden
2013-03-05 16:49 Sven Eden
2013-03-05 16:49 Sven Eden
2013-03-05 16:49 Sven Eden
2013-02-21 10:02 Sven Eden
2013-02-19 15:16 Sven Eden
2013-02-19 13:34 Sven Eden
2013-02-18  7:22 Sven Eden
2013-02-15  8:36 Sven Eden
2013-02-15  8:36 Sven Eden
2013-02-14  8:35 Sven Eden
2013-02-14  8:35 Sven Eden
2013-02-14  8:35 Sven Eden
2013-02-13  9:23 Sven Eden
2013-02-13  9:23 Sven Eden
2013-02-13  9:23 Sven Eden
2013-02-13  9:23 Sven Eden
2013-02-13  9:23 Sven Eden
2013-02-12 10:51 Sven Eden
2013-02-12 10:51 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-06  9:09 Sven Eden
2013-02-06  9:09 Sven Eden
2013-02-05 18:06 Paul Varner
2013-02-05 13:53 Sven Eden
2013-02-05 13:53 Sven Eden
2013-02-05 11:24 Sven Eden
2013-02-03 14:32 Sven Eden
2013-02-03 14:32 Sven Eden
2013-02-03 14:32 Sven Eden
2013-02-03 14:32 Sven Eden
2013-02-03 14:32 Sven Eden
2013-02-02 20:49 Sven Eden
2013-02-02 10:11 Sven Eden
2013-02-02  9:47 Sven Eden
2013-02-02  9:47 Sven Eden
2013-02-02  9:47 Sven Eden
2013-02-01 21:12 Sven Eden
2013-02-01 21:12 Sven Eden
2013-02-01 21:12 Sven Eden
2013-02-01 16:04 Sven Eden
2013-02-01 15:55 Sven Eden
2013-02-01 15:26 Sven Eden
2013-02-01 14:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-01-24 10:15 Sven Eden
2013-01-24 10:15 Sven Eden
2013-01-24 10:15 Sven Eden
2013-01-24 10:15 Sven Eden
2013-01-24 10:15 Sven Eden
2013-01-23 14:44 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-16 13:43 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-08 11:02 Sven Eden
2013-01-02  8:47 Sven Eden
2013-01-02  8:01 Sven Eden
2013-01-02  8:01 Sven Eden
2012-11-20 17:31 Paul Varner
2012-11-20 17:25 Paul Varner
2012-10-23 16:13 Paul Varner
2012-10-23 16:13 Paul Varner
2012-10-23 16:13 Paul Varner
2012-10-23 16:01 Paul Varner
2012-10-22 20:42 Paul Varner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1360913911.5210deeb7d6c8f4cca79b37a9aae22147216a9ac.yamakuzure@gentoo \
    --to=sven.eden@gmx.de \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox