_global_updates: scan binarytree only if needed
authorZac Medico <zmedico@gentoo.org>
Mon, 24 Sep 2012 15:17:11 +0000 (08:17 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 24 Sep 2012 15:17:11 +0000 (08:17 -0700)
This will fix bug #436084.

pym/portage/_global_updates.py

index c0f3df0b669d6f70a57fd654e7314f9920b00e92..9ae734b242bdb2ac031caffcc89a98af88713050 100644 (file)
@@ -46,12 +46,6 @@ def _do_global_updates(trees, prev_mtimes, quiet=False, if_mtime_changed=True):
        portdb = trees[root]["porttree"].dbapi
        vardb = trees[root]["vartree"].dbapi
        bindb = trees[root]["bintree"].dbapi
-       if not os.access(bindb.bintree.pkgdir, os.W_OK):
-               bindb = None
-       else:
-               # Call binarytree.populate(), since we want to make sure it's
-               # only populated with local packages here (getbinpkgs=0).
-               bindb.bintree.populate()
 
        world_file = os.path.join(mysettings['EROOT'], WORLD_FILE)
        world_list = grabfile(world_file)
@@ -120,6 +114,14 @@ def _do_global_updates(trees, prev_mtimes, quiet=False, if_mtime_changed=True):
                        if myupd:
                                retupd = True
 
+       if retupd:
+               if os.access(bindb.bintree.pkgdir, os.W_OK):
+                       # Call binarytree.populate(), since we want to make sure it's
+                       # only populated with local packages here (getbinpkgs=0).
+                       bindb.bintree.populate()
+               else:
+                       bindb = None
+
        master_repo = portdb.getRepositoryName(portdb.porttree_root)
        if master_repo in repo_map:
                repo_map['DEFAULT'] = repo_map[master_repo]