diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-08-22 21:35:47 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-08-22 21:35:47 +0000 |
commit | f7e93905cea59280770ce127d48ab3a968c1326e (patch) | |
tree | d825433163552534bed54c9529852cfd4dbec3a2 /bin | |
parent | 53f8767741b3fb7e4ebbdff65fb9c1e939bf4717 (diff) | |
download | portage-f7e93905cea59280770ce127d48ab3a968c1326e.tar.gz portage-f7e93905cea59280770ce127d48ab3a968c1326e.tar.bz2 portage-f7e93905cea59280770ce127d48ab3a968c1326e.zip |
Pass complete package metadata from depgraph.select_dep() into create() in order to minimize aux_get calls. (trunk r7663)
svn path=/main/branches/2.1.2/; revision=7667
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/emerge | 77 |
1 files changed, 37 insertions, 40 deletions
diff --git a/bin/emerge b/bin/emerge index 179899046..09d46ac22 100755 --- a/bin/emerge +++ b/bin/emerge @@ -1232,7 +1232,7 @@ class depgraph: return flags return None - def create(self, mybigkey, myparent=None, addme=1, myuse=None, + def create(self, mybigkey, myparent=None, addme=1, metadata=None, priority=DepPriority(), rev_dep=False, arg=None): """ Fills the digraph with nodes comprised of packages to merge. @@ -1248,7 +1248,6 @@ class depgraph: # unused parameters rev_dep = False - myuse = None mytype, myroot, mykey = mybigkey @@ -1272,16 +1271,13 @@ class depgraph: # directive, otherwise we add a "merge" directive. mydbapi = self.trees[myroot][self.pkg_tree_map[mytype]].dbapi - metadata = dict(izip(self._mydbapi_keys, - mydbapi.aux_get(mykey, self._mydbapi_keys))) - if mytype == "ebuild": - 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 metadata is None: + metadata = dict(izip(self._mydbapi_keys, + mydbapi.aux_get(mykey, self._mydbapi_keys))) + if mytype == "ebuild": + pkgsettings.setcpv(mykey, mydb=portdb) + metadata["USE"] = pkgsettings["USE"] + myuse = metadata["USE"].split() if not arg and myroot == self.target_root: try: @@ -1533,8 +1529,7 @@ class depgraph: print colorize("BAD", "\n*** You need to adjust PKGDIR to emerge this package.\n") return 0, myfavorites if not self.create(["binary", myroot, mykey], - None, "--onlydeps" not in self.myopts, - myuse=mytbz2.getelements("USE"), arg=x): + addme=("--onlydeps" not in self.myopts), arg=x): return (0,myfavorites) arg_atoms.append((x, "="+mykey)) elif ext==".ebuild": @@ -1808,7 +1803,7 @@ class depgraph: for x in mymerge: selected_pkg = None if x[0]=="!": - selected_pkg = ["blocks", myroot, x[1:], None] + selected_pkg = (["blocks", myroot, x[1:]], None) else: #We are not processing a blocker but a normal dependency if myparent: @@ -1840,13 +1835,14 @@ class depgraph: not portdb.cpv_exists(pkg)] if myeb_pkg_matches: myeb_pkg = portage.best(myeb_pkg_matches) + metadata = dict(izip(self._mydbapi_keys, + bindb.aux_get(myeb_pkg, self._mydbapi_keys))) if myeb_pkg and \ ("--newuse" in self.myopts or \ "--reinstall" in self.myopts): - iuses = set(filter_iuse_defaults( - bindb.aux_get(myeb_pkg, ["IUSE"])[0].split())) - old_use = bindb.aux_get(myeb_pkg, ["USE"])[0].split() + iuses = set(filter_iuse_defaults(metadata["IUSE"].split())) + old_use = metadata["USE"].split() mydb = None if "--usepkgonly" not in self.myopts and myeb: mydb = portdb @@ -1866,15 +1862,16 @@ class depgraph: forced_flags, old_use, iuses, now_use, cur_iuse): myeb_pkg = None if myeb_pkg: - binpkguseflags = \ - self.trees[myroot]["bintree"].dbapi.aux_get( - myeb_pkg, ["USE"])[0].split() matched_packages.append( - ["binary", myroot, myeb_pkg, binpkguseflags]) + (["binary", myroot, myeb_pkg], metadata)) if "--usepkgonly" not in self.myopts and myeb_matches: + metadata = dict(izip(self._mydbapi_keys, + portdb.aux_get(myeb, self._mydbapi_keys))) + pkgsettings.setcpv(myeb, mydb=portdb) + metadata["USE"] = pkgsettings["USE"] matched_packages.append( - ["ebuild", myroot, myeb, None]) + (["ebuild", myroot, myeb], metadata)) if not matched_packages and \ not (arg and "selective" not in self.myparams): @@ -1891,10 +1888,10 @@ class depgraph: if myeb_inst_matches: myeb_inst = portage.best(myeb_inst_matches) if myeb_inst: - binpkguseflags = vardb.aux_get( - myeb_inst, ["USE"])[0].split() + metadata = dict(izip(self._mydbapi_keys, + bindb.aux_get(vardb, self._mydbapi_keys))) matched_packages.append( - ["installed", myroot, myeb_inst, binpkguseflags]) + (["installed", myroot, myeb_inst], metadata)) if not matched_packages: if raise_on_missing: @@ -1937,46 +1934,46 @@ class depgraph: return 0 if "--debug" in self.myopts: - for pkg in matched_packages: + for pkg, metadata in matched_packages: print (pkg[0] + ":").rjust(10), pkg[2] if len(matched_packages) > 1: bestmatch = portage.best( - [pkg[2] for pkg in matched_packages]) + [pkg[2] for pkg, metadata in matched_packages]) matched_packages = [pkg for pkg in matched_packages \ - if pkg[2] == bestmatch] + if pkg[0][2] == bestmatch] # ordered by type preference ("ebuild" type is the last resort) selected_pkg = matched_packages[0] - pkgtype, myroot, mycpv, myuse = selected_pkg + (pkgtype, myroot, mycpv), metadata = selected_pkg mydbapi = self.trees[myroot][self.pkg_tree_map[pkgtype]].dbapi slot_atom = "%s:%s" % (portage.dep_getkey(mycpv), - mydbapi.aux_get(mycpv, ["SLOT"])[0]) + metadata["SLOT"]) existing_node = self._slot_node_map[myroot].get( slot_atom, None) if existing_node: e_type, myroot, e_cpv, e_status = existing_node - if portage.match_from_list(x, [e_cpv]): - # The existing node can be reused. - # Just pass in None for myuse since - # self.create() doesn't use it anymore. - selected_pkg = [e_type, myroot, e_cpv, None] + metadata = dict(izip(self._mydbapi_keys, + self.mydbapi[myroot].aux_get(e_cpv, self._mydbapi_keys))) + cpv_slot = "%s:%s" % (e_cpv, metadata["SLOT"]) + if portage.match_from_list(x, [cpv_slot]): + selected_pkg = ([e_type, myroot, e_cpv], metadata) if myparent: #we are a dependency, so we want to be unconditionally added mypriority = priority.copy() if vardb.match(x): mypriority.satisfied = True - if not self.create(selected_pkg[0:3], myparent, - myuse=selected_pkg[-1], priority=mypriority, + if not self.create(selected_pkg[0], myparent=myparent, + metadata=selected_pkg[1], priority=mypriority, rev_dep=rev_deps, arg=arg): return 0 else: #if mysource is not set, then we are a command-line dependency and should not be added #if --onlydeps is specified. - if not self.create(selected_pkg[0:3], myparent, + if not self.create(selected_pkg[0], myparent=myparent, addme=("--onlydeps" not in self.myopts), - myuse=selected_pkg[-1], rev_dep=rev_deps, arg=arg): + metadata=selected_pkg[1], rev_dep=rev_deps, arg=arg): return 0 if "--debug" in self.myopts: |