Limit repository-wide dbentry updates.
authorMichał Górny <gentoo@mgorny.alt.pl>
Thu, 8 Jul 2010 09:06:28 +0000 (11:06 +0200)
committerZac Medico <zmedico@gentoo.org>
Tue, 27 Jul 2010 23:13:16 +0000 (16:13 -0700)
Update dbentries only when the repository the package comes from matches
the repository update comes from.

pym/portage/_global_updates.py
pym/portage/dbapi/__init__.py

index a63e68af9eb9ff22b480aa71ad2530f270a4825a..b287654c0cc00aa81c72751c7e66e247b9d392bf 100644 (file)
@@ -154,12 +154,12 @@ def _global_updates(trees, prev_mtimes):
                                def onUpdate(maxval, curval):
                                        if curval > 0:
                                                writemsg_stdout("#")
-                               vardb.update_ents(myupd, onUpdate=onUpdate)
+                               vardb.update_ents(myupd, onUpdate=onUpdate, repo=repo_name)
                                if bindb:
                                        def onUpdate(maxval, curval):
                                                if curval > 0:
                                                        writemsg_stdout("*")
-                                       bindb.update_ents(myupd, onUpdate=onUpdate)
+                                       bindb.update_ents(myupd, onUpdate=onUpdate, repo=repo_name)
                        else:
                                do_upgrade_packagesmessage = 1
 
index c2e7989b835c83e7a8da30fc94ac65efc98b00cb..88af46ba80277fb76865d78e3fcf29fee9b6d8e1 100644 (file)
@@ -197,7 +197,7 @@ class dbapi(object):
                else:
                        writemsg("!!! Invalid db entry: %s\n" % mypath, noiselevel=-1)
 
-       def update_ents(self, updates, onProgress=None, onUpdate=None):
+       def update_ents(self, updates, onProgress=None, onUpdate=None, repo=None):
                """
                Update metadata of all packages for package moves.
                @param updates: A list of move commands
@@ -208,6 +208,8 @@ class dbapi(object):
                        for packages that are modified by updates.
                @type onUpdate: a callable that takes 2 integer arguments:
                        maxval and curval
+               @param repo: Name of the repository which packages should be updated
+               @type repo: string
                """
                cpv_all = self.cpv_all()
                cpv_all.sort()
@@ -221,6 +223,8 @@ class dbapi(object):
                if onProgress:
                        onProgress(maxval, 0)
                for i, cpv in enumerate(cpv_all):
+                       if repo and aux_get(cpv, ['repository'])[0] != repo:
+                               continue
                        metadata = dict(zip(update_keys, aux_get(cpv, update_keys)))
                        metadata_updates = update_dbentries(updates, metadata)
                        if metadata_updates: