Optimize dep_zapdeps to work without a vartree when called by repoman.
authorZac Medico <zmedico@gentoo.org>
Tue, 2 Jan 2007 10:42:50 +0000 (10:42 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 2 Jan 2007 10:42:50 +0000 (10:42 -0000)
svn path=/main/trunk/; revision=5444

bin/repoman
pym/portage.py

index fabde28219f838c94f64b85f82c35ea4c43f1a4f..f3fb731d4a0c5b45b939978bfb4026e26590be9f 100755 (executable)
@@ -477,7 +477,7 @@ trees["/"]["porttree"].settings = repoman_settings
 portdb = trees["/"]["porttree"].dbapi
 portdb.mysettings = repoman_settings
 # dep_zapdeps looks at the vardbapi, but it shouldn't for repoman.
-trees["/"]["vartree"].dbapi = portage.fakedbapi(settings=repoman_settings)
+del trees["/"]["vartree"]
 
 if not myreporoot:
        myreporoot = os.path.basename(portdir_overlay)
index 685ba9568f85847765ac79c810ec4fc8ab4da82e..3903d3dde9d14af68c8399215fdd8e70d31441e4 100644 (file)
@@ -3962,7 +3962,9 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
        other = []
 
        # Alias the trees we'll be checking availability against
-       vardb = trees[myroot]["vartree"].dbapi
+       vardb = None
+       if "vartree" in trees[myroot]:
+               vardb = trees[myroot]["vartree"].dbapi
        if use_binaries:
                mydbapi = trees[myroot]["bintree"].dbapi
        else:
@@ -3977,6 +3979,17 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
                else:
                        atoms = [dep]
 
+               all_available = True
+               for atom in atoms:
+                       if not mydbapi.match(atom):
+                               all_available = False
+                               break
+
+               if not vardb:
+                       # called by repoman
+                       preferred.append((atoms, None, all_available))
+                       continue
+
                """ The package names rather than the exact atoms are used for an
                initial rough match against installed packages.  More specific
                preference selection is handled later via slot and version comparison."""
@@ -3987,12 +4000,6 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
                                all_installed = False
                                break
 
-               all_available = True
-               for atom in atoms:
-                       if not mydbapi.match(atom):
-                               all_available = False
-                               break
-
                # Check if the set of atoms will result in a downgrade of
                # an installed package. If they will then don't prefer them
                # over other atoms.