From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-558081-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id DC61F1389C3
	for <garchives@archives.gentoo.org>; Tue, 12 Feb 2013 09:01:22 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id AC17721C046;
	Tue, 12 Feb 2013 09:01:21 +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 D19A021C004
	for <gentoo-commits@lists.gentoo.org>; Tue, 12 Feb 2013 09:01:20 +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 B855E33E694
	for <gentoo-commits@lists.gentoo.org>; Tue, 12 Feb 2013 09:01:19 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by hornbill.gentoo.org (Postfix) with ESMTP id 9EEA6E4089
	for <gentoo-commits@lists.gentoo.org>; Tue, 12 Feb 2013 09:01:17 +0000 (UTC)
From: "Sven Eden" <sven.eden@gmx.de>
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" <sven.eden@gmx.de>
Message-ID: <1360443455.4feb4630700694d561b15a30f7baf16cb786898e.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: 4feb4630700694d561b15a30f7baf16cb786898e
X-VCS-Branch: master
Date: Tue, 12 Feb 2013 09:01:17 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 19a78a8b-0bdd-4a4d-9f4f-5cb876b80762
X-Archives-Hash: 62e371c2e9940fbc8f0db53b8b85251a

commit:     4feb4630700694d561b15a30f7baf16cb786898e
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Sat Feb  9 20:57:35 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sat Feb  9 20:57:35 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=4feb4630

Add "affected" packages (local flags without own descriptions but different settings than the global flag) to central use flag hash.

---
 Portage.pm |   37 +++++++++++++++++--------------------
 1 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 7ebcbdb..a49a5f2 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -304,7 +304,7 @@ sub _gen_use_flags
 		my $flagRef  = $_use_temp->{$flag}; ## Shortcut
 		my $hasGlobal= defined($flagRef->{global}) ? 1 : 0;
 		my $lCount   = ($hasGlobal && length($flagRef->{global}{descr})) ? 1 : 0;
-		my $gDesc    = "";
+		my $gDesc    = "(Unknown)";
 		my $gKey     = "";
 		my $gRef     = $flagRef->{global};
 		my $pDesc    = "";
@@ -314,25 +314,28 @@ sub _gen_use_flags
 		# Build the description consolidation hash
 		if ($hasGlobal) {
 			$gDesc = $gRef->{descr};
-			$gKey  = sprintf("[%s]%d:%d:%d:%d:%d:%d", $gDesc, $gRef->{conf}, $gRef->{"default"},
-							$gRef->{forced}, $gRef->{installed}, $gRef->{masked}, $gRef->{"package"});
+			$gKey  = sprintf("[%s]%d:%d:%d:%d:%d:%d:%d", $gDesc, $gRef->{conf}, $gRef->{"default"},
+							$gRef->{forced}, $gRef->{installed}, $gRef->{masked},
+							$gRef->{"package"}, $gRef->{pkguse});
 			$descCons{$gKey}{global} = 1;
 		}
 		for my $pkg (sort keys %{$flagRef->{"local"}}) {
 			$pRef  = $flagRef->{"local"}{$pkg};
-
-			if (length($pRef->{descr})) {
-				## This package has an individual description:
-				$pDesc = "$pRef->{descr}";
-				$pKey  = sprintf("[%s]%d:%d:%d:%d:%d:%d", $pDesc, $pRef->{conf}, $pRef->{"default"},
-								$pRef->{forced}, $pRef->{installed}, $pRef->{masked}, $pRef->{"package"});
+			$pDesc = "$pRef->{descr}";
+			
+			# If the flag has no local description, it is "affected"
+			length($pDesc) or $pDesc = $gDesc;
+
+			# Now the Key can be assembled...
+			$pKey  = sprintf("[%s]%d:%d:%d:%d:%d:%d:%d", $pDesc, $pRef->{conf}, $pRef->{"default"},
+							$pRef->{forced}, $pRef->{installed}, $pRef->{masked},
+							$pRef->{"package"}, $pRef->{pkguse});
+							
+			# ...and safed, unless it equals the global key
+			if ($pKey ne $gKey) {
 				$descCons{$pKey}{$pkg} = 1;
 				++$lCount;
 			}
-
-			## TODO : Add affected packages that have no own description
-			# once the interface can handle them. These can be used for
-			# the package filtering per command line arguments later.
 		} ## End of walking through a flags package list
 		
 		# Skip if there was nothing consolidated
@@ -342,16 +345,10 @@ sub _gen_use_flags
 		$use_flags->{$flag}{count} = 0;
 		
 		# The global data has to be added first:
-		if (length($gKey)) {
-			_add_flag($flag, "global", $gKey);
-			
-			# TODO : Add affected packages once they can be hanlded. See above TODO.
-		}
+		length($gKey) and _add_flag($flag, "global", $gKey);
 		
 		# Then the "local" flag descriptions
-		# TODO : Add affected packages that have diffeent settings once they can be handled.
 		for my $key (sort keys %descCons) {
-			next if ($key eq $gKey);
 
 			# Generate the package list with same description and flags,
 			# but not for more than 5 packages