From a0e151f5dd05e288440d215561d7fa27e288e495 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 6 Oct 2006 10:26:54 +0000 Subject: For bug #48195, fall back to the installed packages when there are no other choices. Global updates are automatically performed on *DEPEND if necessary in order to clean up stale atoms (we do single packages as necessary because it's too time consuming to do the whole vdb at once). svn path=/main/trunk/; revision=4605 --- bin/emerge | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/emerge b/bin/emerge index 6192ca36c..b2322829a 100755 --- a/bin/emerge +++ b/bin/emerge @@ -678,6 +678,7 @@ class depgraph: "--getbinpkg" in self.myopts, "--getbinpkgonly" in self.myopts) self.args_keys = [] + self.global_updates = {} def create(self, mybigkey, myparent=None, addme=1, myuse=None, priority=digraph.HARD, rev_dep=False, arg=None): @@ -741,7 +742,9 @@ class depgraph: self.useFlags[myroot][mykey] = myuse merging=1 - if addme: + if mytype == "installed": + merging = 0 + if addme and mytype != "installed": # this is where we add the node to the list of packages to merge if "selective" in self.myparams or not arg: if "empty" not in self.myparams and vardbapi.cpv_exists(mykey): @@ -1154,6 +1157,42 @@ class depgraph: matched_packages.append( ["ebuild", myroot, myeb, None]) + if not matched_packages: + """Fall back to the installed package database. This is a + last resort because the metadata tends to diverge from that + of the ebuild in the tree.""" + myeb_inst = portage.best(vardb.match(x)) + if myeb_inst: + binpkguseflags = vardb.aux_get( + myeb_inst, ["USE"])[0].split() + matched_packages.append( + ["installed", myroot, myeb_inst, binpkguseflags]) + """Now make sure that *DEPEND atoms are up to date. + This is done on the fly for single packages only when + necessary, since it can be time consuming to run this + on all installed packages.""" + from portage_update import grab_updates, \ + parse_updates, update_dbentries + if myroot not in self.global_updates: + updpath = os.path.join( + pkgsettings["PORTDIR"], "profiles", "updates") + try: + rawupdates = grab_updates(updpath) + except portage_exception.DirectoryNotFound: + rawupdates = [] + upd_commands = [] + for mykey, mystat, mycontent in rawupdates: + commands, errors = parse_updates(mycontent) + upd_commands.extend(commands) + self.global_updates[myroot] = upd_commands + upd_commands = self.global_updates[myroot] + aux_keys = ["DEPEND", "RDEPEND", "PDEPEND"] + aux_vals = vardb.aux_get(myeb_inst, aux_keys) + aux_dict = dict(zip(aux_keys, aux_vals)) + updates = update_dbentries(upd_commands, aux_dict) + if updates: + vardb.aux_update(myeb_inst, updates) + if not matched_packages: if raise_on_missing: raise ValueError -- cgit v1.2.3-1-g7c22