Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r12157 - in main/trunk/pym/portage: . dbapi
Date: Thu, 04 Dec 2008 23:56:16
Message-Id: E1L8O3K-00017K-07@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-12-04 23:56:13 +0000 (Thu, 04 Dec 2008)
3 New Revision: 12157
4
5 Modified:
6 main/trunk/pym/portage/__init__.py
7 main/trunk/pym/portage/dbapi/__init__.py
8 Log:
9 Make fixpackages less noisy by only generting '*' characters for packages
10 that are modified by updates.
11
12
13 Modified: main/trunk/pym/portage/__init__.py
14 ===================================================================
15 --- main/trunk/pym/portage/__init__.py 2008-12-04 21:13:09 UTC (rev 12156)
16 +++ main/trunk/pym/portage/__init__.py 2008-12-04 23:56:13 UTC (rev 12157)
17 @@ -7376,11 +7376,12 @@
18 # We gotta do the brute force updates for these now.
19 if mysettings["PORTAGE_CALLER"] == "fixpackages" or \
20 "fixpackages" in mysettings.features:
21 - def onProgress(maxval, curval):
22 - writemsg_stdout("*")
23 - vardb.update_ents(myupd, onProgress=onProgress)
24 + def onUpdate(maxval, curval):
25 + if curval > 0:
26 + writemsg_stdout("*")
27 + vardb.update_ents(myupd, onUpdate=onUpdate)
28 if bindb:
29 - bindb.update_ents(myupd, onProgress=onProgress)
30 + bindb.update_ents(myupd, onUpdate=onUpdate)
31 else:
32 do_upgrade_packagesmessage = 1
33
34
35 Modified: main/trunk/pym/portage/dbapi/__init__.py
36 ===================================================================
37 --- main/trunk/pym/portage/dbapi/__init__.py 2008-12-04 21:13:09 UTC (rev 12156)
38 +++ main/trunk/pym/portage/dbapi/__init__.py 2008-12-04 23:56:13 UTC (rev 12157)
39 @@ -200,13 +200,17 @@
40 else:
41 writemsg("!!! Invalid db entry: %s\n" % mypath, noiselevel=-1)
42
43 - def update_ents(self, updates, onProgress=None):
44 + def update_ents(self, updates, onProgress=None, onUpdate=None):
45 """
46 Update metadata of all packages for package moves.
47 @param updates: A list of move commands
48 @type updates: List
49 @param onProgress: A progress callback function
50 @type onProgress: a callable that takes 2 integer arguments: maxval and curval
51 + @param onUpdate: A progress callback function called only
52 + for packages that are modified by updates.
53 + @type onUpdate: a callable that takes 2 integer arguments:
54 + maxval and curval
55 """
56 cpv_all = self.cpv_all()
57 cpv_all.sort()
58 @@ -216,6 +220,8 @@
59 update_keys = ["DEPEND", "RDEPEND", "PDEPEND", "PROVIDE"]
60 from itertools import izip
61 from portage.update import update_dbentries
62 + if onUpdate:
63 + onUpdate(maxval, 0)
64 if onProgress:
65 onProgress(maxval, 0)
66 for i, cpv in enumerate(cpv_all):
67 @@ -223,6 +229,8 @@
68 metadata_updates = update_dbentries(updates, metadata)
69 if metadata_updates:
70 aux_update(cpv, metadata_updates)
71 + if onUpdate:
72 + onUpdate(maxval, i+1)
73 if onProgress:
74 onProgress(maxval, i+1)