From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 18574138A4C for ; Fri, 15 Feb 2013 08:36:51 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7F70121C001; Fri, 15 Feb 2013 08:36:50 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C0D6F21C001 for ; Fri, 15 Feb 2013 08:36:49 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A434133E402 for ; Fri, 15 Feb 2013 08:36:48 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 6A183E407B for ; Fri, 15 Feb 2013 08:36:46 +0000 (UTC) From: "Sven Eden" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sven Eden" Message-ID: <1360913911.5210deeb7d6c8f4cca79b37a9aae22147216a9ac.yamakuzure@gentoo> Subject: [gentoo-commits] proj/ufed:master commit in: / X-VCS-Repository: proj/ufed X-VCS-Files: Portage.pm X-VCS-Directories: / X-VCS-Committer: yamakuzure X-VCS-Committer-Name: Sven Eden X-VCS-Revision: 5210deeb7d6c8f4cca79b37a9aae22147216a9ac X-VCS-Branch: master Date: Fri, 15 Feb 2013 08:36:46 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: f7cf383c-7fe3-45fa-993a-2c4432be4cb5 X-Archives-Hash: c7c159e2fa0062b1a63e59a104131839 commit: 5210deeb7d6c8f4cca79b37a9aae22147216a9ac Author: Sven Eden gmx de> AuthorDate: Fri Feb 15 07:38:31 2013 +0000 Commit: Sven Eden gmx 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; }