In depgraph._load_vdb(), after calling FakeVartree.sync(), update
authorZac Medico <zmedico@gentoo.org>
Mon, 13 Sep 2010 23:43:39 +0000 (16:43 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 13 Sep 2010 23:43:39 +0000 (16:43 -0700)
self._frozen_config.pkgsettings so that it has populated virtuals.

This solves allows us to avoid triggering an AssertionError reported
at http://forums.gentoo.org/viewtopic-t-844519.html with the following
traceback:

Calculating dependencies... done!
Traceback (most recent call last):
  File "/usr/bin/emerge", line 43, in <module>
    retval = emerge_main()
  File "/usr/lib/portage/pym/_emerge/main.py", line 1683, in emerge_main
    myopts, myaction, myfiles, spinner)
  File "/usr/lib/portage/pym/_emerge/actions.py", line 204, in action_build
    settings, trees, mtimedb, myopts, myparams, spinner)
  File "/usr/lib/portage/pym/_emerge/depgraph.py", line 6047, in resume_depgraph
    myparams, spinner)
  File "/usr/lib/portage/pym/_emerge/depgraph.py", line 6070, in _resume_depgraph
    skip_masked=skip_masked)
  File "/usr/lib/portage/pym/_emerge/depgraph.py", line 5617, in _loadResumeCommand
    if not self._add_pkg(task, None):
  File "/usr/lib/portage/pym/_emerge/depgraph.py", line 893, in _add_pkg
    pkgsettings.setinst(pkg.cpv, pkg.metadata)
  File "/usr/lib/portage/pym/portage/package/ebuild/config.py", line 1757, in setinst
    self._virtuals_manager.add_depgraph_virtuals(mycpv, virts)
  File "/usr/lib/portage/pym/portage/package/ebuild/_config/VirtualsManager.py", line 199, in add_depgraph_virtuals
    self.getvirtuals()
  File "/usr/lib/portage/pym/portage/package/ebuild/_config/VirtualsManager.py", line 156, in getvirtuals
    self._compile_virtuals()
  File "/usr/lib/portage/pym/portage/package/ebuild/_config/VirtualsManager.py", line 131, in _compile_virtuals
    "any query about virtuals"
AssertionError: _populate_treeVirtuals() must be called before any query about virtuals

pym/_emerge/depgraph.py

index 25297541851c2662683a6c184aa2259f82b8c878..b1cbc2b440e32e38bfa158b861d8c18b404dbbf5 100644 (file)
@@ -328,6 +328,11 @@ class depgraph(object):
                                # backtracking depgraphs that share the same frozen_config.
                                fake_vartree.sync()
 
+                               # FakeVartree.sync() populates virtuals, and we want
+                               # self.pkgsettings to have them populated too.
+                               self._frozen_config.pkgsettings[myroot] = \
+                                       portage.config(clone=fake_vartree.settings)
+
                        if preload_installed_pkgs:
                                vardb = fake_vartree.dbapi
                                fakedb = self._dynamic_config._graph_trees[