Make fixpackages less noisy by only generting '*' characters for packages
authorZac Medico <zmedico@gentoo.org>
Thu, 4 Dec 2008 23:57:32 +0000 (23:57 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 4 Dec 2008 23:57:32 +0000 (23:57 -0000)
that are modified by updates. (trunk r12155)

svn path=/main/branches/2.1.6/; revision=12158

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

index 9beb068c3f1d8df745ed4c533ea1dfc06c924eea..e99fe2ce4b41d9da68e27b255d35ff172f5fa4cf 100644 (file)
@@ -7363,11 +7363,12 @@ def _global_updates(trees, prev_mtimes):
                # We gotta do the brute force updates for these now.
                if mysettings["PORTAGE_CALLER"] == "fixpackages" or \
                "fixpackages" in mysettings.features:
-                       def onProgress(maxval, curval):
-                               writemsg_stdout("*")
-                       vardb.update_ents(myupd, onProgress=onProgress)
+                       def onUpdate(maxval, curval):
+                               if curval > 0:
+                                       writemsg_stdout("*")
+                       vardb.update_ents(myupd, onUpdate=onUpdate)
                        if bindb:
-                               bindb.update_ents(myupd, onProgress=onProgress)
+                               bindb.update_ents(myupd, onUpdate=onUpdate)
                else:
                        do_upgrade_packagesmessage = 1
 
index 2bdb3e7cdefaa5d34eea89ec34a3cc705d823689..435ffebbb941a2dd9f51a6944842ee33ae535505 100644 (file)
@@ -200,13 +200,17 @@ class dbapi(object):
                else:
                        writemsg("!!! Invalid db entry: %s\n" % mypath, noiselevel=-1)
 
-       def update_ents(self, updates, onProgress=None):
+       def update_ents(self, updates, onProgress=None, onUpdate=None):
                """
                Update metadata of all packages for package moves.
                @param updates: A list of move commands
                @type updates: List
                @param onProgress: A progress callback function
                @type onProgress: a callable that takes 2 integer arguments: maxval and curval
+               @param onUpdate: A progress callback function called only
+                       for packages that are modified by updates.
+               @type onUpdate: a callable that takes 2 integer arguments:
+                       maxval and curval
                """
                cpv_all = self.cpv_all()
                cpv_all.sort()
@@ -216,6 +220,8 @@ class dbapi(object):
                update_keys = ["DEPEND", "RDEPEND", "PDEPEND", "PROVIDE"]
                from itertools import izip
                from portage.update import update_dbentries
+               if onUpdate:
+                       onUpdate(maxval, 0)
                if onProgress:
                        onProgress(maxval, 0)
                for i, cpv in enumerate(cpv_all):
@@ -223,6 +229,8 @@ class dbapi(object):
                        metadata_updates = update_dbentries(updates, metadata)
                        if metadata_updates:
                                aux_update(cpv, metadata_updates)
+                               if onUpdate:
+                                       onUpdate(maxval, i+1)
                        if onProgress:
                                onProgress(maxval, i+1)