REQUIRED_USE: don't save in built packages
authorZac Medico <zmedico@gentoo.org>
Mon, 7 Nov 2011 15:27:23 +0000 (07:27 -0800)
committerZac Medico <zmedico@gentoo.org>
Mon, 7 Nov 2011 15:27:23 +0000 (07:27 -0800)
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.

bin/phase-functions.sh
pym/_emerge/depgraph.py
pym/_emerge/resolver/circular_dependency.py
pym/_emerge/resolver/slot_collision.py
pym/portage/dbapi/bintree.py
pym/portage/dbapi/vartree.py

index ea3f8a6aee8b206455a6dd1a9f1c07c544951d2f..f46368d688ebf19a195390a4b55f236cbe0d88f3 100644 (file)
@@ -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
index 084864076a5e88c62917bcf4177402e2ce1323fa..2ff6acbe20d216f6def8e8f604239dc7ae9d75ca 100644 (file)
@@ -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)
index d113c5e8bb510e49771142aeb6abb6fd8e335abc..62d555634b2d1c2a3b501c53dbcae0a196b44109 100644 (file)
@@ -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)
index 0df8f20a28013ddbbdb9a86141843a7b85dbf466..320713882923458cddb875cd4143d031b702fb43 100644 (file)
@@ -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
 
index 4c24929905bf84fdf2e13d9977cb609206b4c5c6..31ba364a465b7b23f6d14ab30670efca4b24e6a3 100644 (file)
@@ -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"]
 
index 73772b0e0a64016a7c64c44133c2edc20d12d943..dd74c10f4e02aa1853a5c808858a6d375405f271 100644 (file)
@@ -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")