Unify USE handling in the depgraph with the other metadata. (trunk r7298)
authorZac Medico <zmedico@gentoo.org>
Tue, 17 Jul 2007 19:18:40 +0000 (19:18 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 17 Jul 2007 19:18:40 +0000 (19:18 -0000)
svn path=/main/branches/2.1.2/; revision=7299

bin/emerge

index cdb4ce4b29d15ea013c143d96e71a48762ae7270..a45d7a725859b1ebc352684fc8ca547e84335992 100755 (executable)
@@ -1098,7 +1098,6 @@ class depgraph:
                self.mydbapi = {}
                self._mydbapi_keys = ["SLOT", "DEPEND", "RDEPEND", "PDEPEND",
                        "USE", "IUSE", "PROVIDE", "RESTRICT", "repository"]
-               self.useFlags = {}
                self.trees = {}
                self.roots = {}
                for myroot in trees:
@@ -1128,7 +1127,6 @@ class depgraph:
                                                metadata=dict(izip(self._mydbapi_keys,
                                                vardb.aux_get(pkg, self._mydbapi_keys))))
                        del vardb, fakedb
-                       self.useFlags[myroot] = {}
                        if "--usepkg" in self.myopts:
                                self.trees[myroot]["bintree"].populate(
                                        "--getbinpkg" in self.myopts,
@@ -1290,6 +1288,10 @@ class depgraph:
                        pkgsettings.setcpv(mykey, mydb=portdb)
                        metadata["USE"] = pkgsettings["USE"]
                        myuse = pkgsettings["USE"].split()
+               else:
+                       # The myuse parameter to this method is deprecated, so get it
+                       # directly from the metadata here.
+                       myuse = metadata["USE"].split()
 
                if not arg and myroot == self.target_root:
                        try:
@@ -1388,7 +1390,6 @@ class depgraph:
                                # self.pkg_node_map and self.mydbapi since that data will
                                # be used for blocker validation.
                                self.pkg_node_map[myroot].setdefault(mykey, jbigkey)
-                               self.useFlags[myroot].setdefault(mykey, myuse)
                                # Even though the graph is now invalid, continue to process
                                # dependencies so that things like --fetchonly can still
                                # function despite collisions.
@@ -1396,7 +1397,6 @@ class depgraph:
                                self.mydbapi[myroot].cpv_inject(mykey, metadata=metadata)
                                self._slot_node_map[myroot][slot_atom] = jbigkey
                                self.pkg_node_map[myroot][mykey] = jbigkey
-                               self.useFlags[myroot][mykey] = myuse
                                if reinstall_for_flags:
                                        self._reinstall_nodes[jbigkey] = reinstall_for_flags
 
@@ -1949,8 +1949,9 @@ class depgraph:
                                        e_type, myroot, e_cpv, e_status = existing_node
                                        if portage.match_from_list(x, [e_cpv]):
                                                # The existing node can be reused.
-                                               selected_pkg = [e_type, myroot, e_cpv,
-                                                       self.useFlags[myroot][e_cpv]]
+                                               # Just pass in None for myuse since
+                                               # self.create() doesn't use it anymore.
+                                               selected_pkg = [e_type, myroot, e_cpv, None]
 
                        if myparent:
                                #we are a dependency, so we want to be unconditionally added
@@ -2788,18 +2789,16 @@ class depgraph:
                                                raise portage_exception.PackageNotFound(pkg_key)
                                        repo_path_real = os.path.dirname(os.path.dirname(
                                                os.path.dirname(ebuild_path)))
+                                       pkgsettings.setcpv(pkg_key)
+                                       metadata["USE"] = pkgsettings["USE"]
                                else:
                                        repo_path_real = portdb.getRepositoryPath(repo_name)
-                               if pkg_key not in self.useFlags[myroot]:
-                                       """If this is a --resume then the USE flags need to be
-                                       fetched from the appropriate locations here."""
-                                       self.useFlags[myroot][pkg_key] = mydbapi.aux_get(
-                                               pkg_key, ["USE"])[0].split()
+                               pkg_use = metadata["USE"].split()
 
                                try:
                                        restrict = flatten(use_reduce(paren_reduce(
                                                mydbapi.aux_get(pkg_key, ["RESTRICT"])[0]),
-                                               uselist=self.useFlags[myroot][pkg_key]))
+                                               uselist=pkg_use))
                                except portage_exception.InvalidDependString, e:
                                        if pkg_status != "nomerge":
                                                restrict = mydbapi.aux_get(pkg_key, ["RESTRICT"])[0]
@@ -2812,8 +2811,7 @@ class depgraph:
                                        fetch = red("F")
                                        if ordered:
                                                counters.restrict_fetch += 1
-                                       if portdb.fetch_check(
-                                               pkg_key, self.useFlags[myroot][pkg_key]):
+                                       if portdb.fetch_check(pkg_key, pkg_use):
                                                fetch = green("f")
                                                if ordered:
                                                        counters.restrict_fetch_satisfied += 1
@@ -2866,7 +2864,7 @@ class depgraph:
 
                                verboseadd=""
                                
-                               if pkg_key in self.useFlags[myroot]:
+                               if True:
                                        # USE flag display
                                        cur_iuse = list(filter_iuse_defaults(
                                                mydbapi.aux_get(pkg_key, ["IUSE"])[0].split()))
@@ -2878,7 +2876,7 @@ class depgraph:
 
                                        cur_iuse = portage.unique_array(cur_iuse)
                                        cur_iuse.sort()
-                                       cur_use = self.useFlags[myroot][pkg_key]
+                                       cur_use = pkg_use
                                        cur_use = [flag for flag in cur_use if flag in cur_iuse]
 
                                        if myoldbest:
@@ -2972,8 +2970,7 @@ class depgraph:
                                        if pkg_type == "ebuild" and pkg_merge:
                                                try:
                                                        myfilesdict = portdb.getfetchsizes(pkg_key,
-                                                               useflags=self.useFlags[myroot][pkg_key],
-                                                               debug=self.edebug)
+                                                               useflags=pkg_use, debug=self.edebug)
                                                except portage_exception.InvalidDependString, e:
                                                        src_uri = portdb.aux_get(pkg_key, ["SRC_URI"])[0]
                                                        show_invalid_depstring_notice(x, src_uri, str(e))