1 |
The reporting of files remaining can look somewhat odd since the report |
2 |
interval is hardcoded to be per 1000 objects. Adjust this interval to |
3 |
be time based. This means that modern (fast) machines likely will never |
4 |
see the countdown messages at all. On slow setups the message will be |
5 |
informative that there is progress, albeit rather slowly. While at it, |
6 |
report percentage done. |
7 |
|
8 |
Output before this patch: |
9 |
|
10 |
* checking 6158 files for package collisions |
11 |
5158 files remaining ... |
12 |
4158 files remaining ... |
13 |
3158 files remaining ... |
14 |
2158 files remaining ... |
15 |
1158 files remaining ... |
16 |
158 files remaining ... |
17 |
|
18 |
Possible output after this patch on a slower machine: |
19 |
|
20 |
* checking 6158 files for package collisions |
21 |
48% done, 3145 files remaining ... |
22 |
96% done, 192 files remaining ... |
23 |
100% done |
24 |
|
25 |
Signed-off-by: Fabian Groffen <grobian@g.o> |
26 |
--- |
27 |
lib/portage/dbapi/vartree.py | 11 +++++++++-- |
28 |
1 file changed, 9 insertions(+), 2 deletions(-) |
29 |
|
30 |
diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py |
31 |
index 4b91caea8..244195fad 100644 |
32 |
--- a/lib/portage/dbapi/vartree.py |
33 |
+++ b/lib/portage/dbapi/vartree.py |
34 |
@@ -3475,13 +3475,18 @@ class dblink(object): |
35 |
symlink_collisions = [] |
36 |
destroot = self.settings['ROOT'] |
37 |
totfiles = len(file_list) + len(symlink_list) |
38 |
+ tnow = time.time() |
39 |
+ tinterv = 2 # seconds |
40 |
+ ninterv = tnow + tinterv |
41 |
showMessage(_(" %s checking %d files for package collisions\n") % \ |
42 |
(colorize("GOOD", "*"), totfiles)) |
43 |
for i, (f, f_type) in enumerate(chain( |
44 |
((f, "reg") for f in file_list), |
45 |
((f, "sym") for f in symlink_list))): |
46 |
- if i % 1000 == 0 and i != 0: |
47 |
- showMessage(_("%d files remaining ...\n") % (totfiles - i)) |
48 |
+ if time.time() > ninterv: |
49 |
+ showMessage(_("%3d%% done, %d files remaining ...\n") % |
50 |
+ (i * 100 / totfiles, totfiles - i)) |
51 |
+ ninterv = time.time() + tinterv |
52 |
|
53 |
dest_path = normalize_path( |
54 |
os.path.join(destroot, f.lstrip(os.path.sep))) |
55 |
@@ -3570,6 +3575,8 @@ class dblink(object): |
56 |
break |
57 |
if stopmerge: |
58 |
collisions.append(f) |
59 |
+ if tnow + tinterv < ninterv: |
60 |
+ showMessage(_("100% done\n")) |
61 |
return collisions, dirs_ro, symlink_collisions, plib_collisions |
62 |
|
63 |
def _lstat_inode_map(self, path_iter): |
64 |
-- |
65 |
2.20.1 |