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 | 13 +++++++++++-- |
28 |
1 file changed, 11 insertions(+), 2 deletions(-) |
29 |
|
30 |
diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py |
31 |
index 4b91caea8..df192e6fc 100644 |
32 |
--- a/lib/portage/dbapi/vartree.py |
33 |
+++ b/lib/portage/dbapi/vartree.py |
34 |
@@ -35,6 +35,7 @@ portage.proxy.lazyimport.lazyimport(globals(), |
35 |
'portage.util.install_mask:install_mask_dir,InstallMask', |
36 |
'portage.util.listdir:dircache,listdir', |
37 |
'portage.util.movefile:movefile', |
38 |
+ 'portage.util.monotonic:monotonic', |
39 |
'portage.util.path:first_existing,iter_parents', |
40 |
'portage.util.writeable_check:get_ro_checker', |
41 |
'portage.util._xattr:xattr', |
42 |
@@ -3475,13 +3476,19 @@ class dblink(object): |
43 |
symlink_collisions = [] |
44 |
destroot = self.settings['ROOT'] |
45 |
totfiles = len(file_list) + len(symlink_list) |
46 |
+ tnow = monotonic() |
47 |
+ tinterv = 2 # seconds |
48 |
+ ninterv = tnow + tinterv |
49 |
+ falign = len("%d" % totfiles) |
50 |
showMessage(_(" %s checking %d files for package collisions\n") % \ |
51 |
(colorize("GOOD", "*"), totfiles)) |
52 |
for i, (f, f_type) in enumerate(chain( |
53 |
((f, "reg") for f in file_list), |
54 |
((f, "sym") for f in symlink_list))): |
55 |
- if i % 1000 == 0 and i != 0: |
56 |
- showMessage(_("%d files remaining ...\n") % (totfiles - i)) |
57 |
+ if monotonic() > ninterv: |
58 |
+ showMessage(_("%3d%% done, %*d files remaining ...\n") % |
59 |
+ (falign, i * 100 / totfiles, totfiles - i)) |
60 |
+ ninterv = monotonic() + tinterv |
61 |
|
62 |
dest_path = normalize_path( |
63 |
os.path.join(destroot, f.lstrip(os.path.sep))) |
64 |
@@ -3570,6 +3577,8 @@ class dblink(object): |
65 |
break |
66 |
if stopmerge: |
67 |
collisions.append(f) |
68 |
+ if tnow + tinterv < ninterv: |
69 |
+ showMessage(_("100% done\n")) |
70 |
return collisions, dirs_ro, symlink_collisions, plib_collisions |
71 |
|
72 |
def _lstat_inode_map(self, path_iter): |
73 |
-- |
74 |
2.20.1 |