From: Zac Medico <zmedico@gentoo.org>
Date: Mon, 7 Nov 2011 15:27:23 +0000 (-0800)
Subject: REQUIRED_USE: don't save in built packages
X-Git-Tag: v2.2.0_alpha73~19
X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a0961708ced50c90497811058eda6f4513d2986d;p=portage.git

REQUIRED_USE: don't save in built packages

It should be safe to assume that REQUIRED_USE is satisfied if the
package is built, so it's a waste to save it. Also, fix code which
assumes that built Package instances have a REQUIRED_USE key in their
metadata.
---

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index ea3f8a6ae..f46368d68 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -540,7 +540,7 @@ dyn_install() {
 	set -f
 	local f x
 	IFS=$' \t\n\r'
-	for f in CATEGORY DEFINED_PHASES FEATURES INHERITED IUSE REQUIRED_USE \
+	for f in CATEGORY DEFINED_PHASES FEATURES INHERITED IUSE \
 		PF PKGUSE SLOT KEYWORDS HOMEPAGE DESCRIPTION ; do
 		x=$(echo -n ${!f})
 		[[ -n $x ]] && echo "$x" > $f
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 084864076..2ff6acbe2 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -3066,7 +3066,7 @@ class depgraph(object):
 					continue
 
 				missing_use_adjustable.add(pkg)
-				required_use = pkg.metadata["REQUIRED_USE"]
+				required_use = pkg.metadata.get("REQUIRED_USE")
 				required_use_warning = ""
 				if required_use:
 					old_use = self._pkg_use_enabled(pkg)
diff --git a/pym/_emerge/resolver/circular_dependency.py b/pym/_emerge/resolver/circular_dependency.py
index d113c5e8b..62d555634 100644
--- a/pym/_emerge/resolver/circular_dependency.py
+++ b/pym/_emerge/resolver/circular_dependency.py
@@ -143,7 +143,8 @@ class circular_dependency_handler(object):
 
 			#If any of the flags we're going to touch is in REQUIRED_USE, add all
 			#other flags in REQUIRED_USE to affecting_use, to not lose any solution.
-			required_use_flags = get_required_use_flags(parent.metadata["REQUIRED_USE"])
+			required_use_flags = get_required_use_flags(
+				parent.metadata.get("REQUIRED_USE", ""))
 
 			if affecting_use.intersection(required_use_flags):
 				# TODO: Find out exactly which REQUIRED_USE flags are
@@ -185,7 +186,7 @@ class circular_dependency_handler(object):
 					parent_atom not in reduced_dep:
 					#We found an assignment that removes the atom from 'dep'.
 					#Make sure it doesn't conflict with REQUIRED_USE.
-					required_use = parent.metadata["REQUIRED_USE"]
+					required_use = parent.metadata.get("REQUIRED_USE", "")]
 
 					if check_required_use(required_use, current_use, parent.iuse.is_valid_flag):
 						use = self.depgraph._pkg_use_enabled(parent)
diff --git a/pym/_emerge/resolver/slot_collision.py b/pym/_emerge/resolver/slot_collision.py
index 0df8f20a2..320713882 100644
--- a/pym/_emerge/resolver/slot_collision.py
+++ b/pym/_emerge/resolver/slot_collision.py
@@ -843,7 +843,7 @@ class slot_conflict_handler(object):
 
 		#Make sure the changes don't violate REQUIRED_USE
 		for pkg in required_changes:
-			required_use = pkg.metadata["REQUIRED_USE"]
+			required_use = pkg.metadata.get("REQUIRED_USE")
 			if not required_use:
 				continue
 
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index 4c2492990..31ba364a4 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -68,7 +68,7 @@ class bindbapi(fakedbapi):
 			["BUILD_TIME", "CHOST", "DEPEND", "EAPI", "IUSE", "KEYWORDS",
 			"LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE",
 			"RDEPEND", "repository", "RESTRICT", "SLOT", "USE", "DEFINED_PHASES",
-			"REQUIRED_USE"])
+			])
 		self._aux_cache_slot_dict = slot_dict_class(self._aux_cache_keys)
 		self._aux_cache = {}
 
@@ -290,7 +290,7 @@ class binarytree(object):
 				["BUILD_TIME", "CHOST", "DEPEND", "DESCRIPTION", "EAPI",
 				"IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PROPERTIES",
 				"PROVIDE", "RDEPEND", "repository", "SLOT", "USE", "DEFINED_PHASES",
-				"REQUIRED_USE", "BASE_URI"]
+				"BASE_URI"]
 			self._pkgindex_aux_keys = list(self._pkgindex_aux_keys)
 			self._pkgindex_use_evaluated_keys = \
 				("LICENSE", "RDEPEND", "DEPEND",
@@ -316,7 +316,6 @@ class binarytree(object):
 				"SLOT"    : "0",
 				"USE"     : "",
 				"DEFINED_PHASES" : "",
-				"REQUIRED_USE" : ""
 			}
 			self._pkgindex_inherited_keys = ["CHOST", "repository"]
 
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 73772b0e0..dd74c10f4 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -157,7 +157,7 @@ class vardbapi(dbapi):
 			"EAPI", "HOMEPAGE", "IUSE", "KEYWORDS",
 			"LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND",
 			"repository", "RESTRICT" , "SLOT", "USE", "DEFINED_PHASES",
-			"REQUIRED_USE"])
+			])
 		self._aux_cache_obj = None
 		self._aux_cache_filename = os.path.join(self._eroot,
 			CACHE_PATH, "vdb_metadata.pickle")