summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-10-06 10:26:54 +0000
committerZac Medico <zmedico@gentoo.org>2006-10-06 10:26:54 +0000
commita0e151f5dd05e288440d215561d7fa27e288e495 (patch)
treec644413a7ddf54ffc945d89e279b9a68ca44a35a
parentfed10d47a1d1d3d0362c9868aa24a5f94e012525 (diff)
downloadportage-a0e151f5dd05e288440d215561d7fa27e288e495.tar.gz
portage-a0e151f5dd05e288440d215561d7fa27e288e495.tar.bz2
portage-a0e151f5dd05e288440d215561d7fa27e288e495.zip
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
-rwxr-xr-xbin/emerge41
1 files changed, 40 insertions, 1 deletions
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):
@@ -1155,6 +1158,42 @@ class depgraph:
["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
if not arg: