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 regular towards the end. While at it, report percentage done. |
4 |
|
5 |
Output before this patch: |
6 |
|
7 |
* checking 6111 files for package collisions |
8 |
5111 files remaining ... |
9 |
4111 files remaining ... |
10 |
3111 files remaining ... |
11 |
2111 files remaining ... |
12 |
1111 files remaining ... |
13 |
111 files remaining ... |
14 |
|
15 |
After: |
16 |
|
17 |
* checking 6158 files for package collisions |
18 |
16% done, 5131 files remaining ... |
19 |
33% done, 4104 files remaining ... |
20 |
50% done, 3077 files remaining ... |
21 |
66% done, 2050 files remaining ... |
22 |
83% done, 1023 files remaining ... |
23 |
100% done |
24 |
|
25 |
Signed-off-by: Fabian Groffen <grobian@g.o> |
26 |
--- |
27 |
lib/portage/dbapi/vartree.py | 14 +++++++++++--- |
28 |
1 file changed, 11 insertions(+), 3 deletions(-) |
29 |
|
30 |
diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py |
31 |
index 4b91caea8..78f2b37f2 100644 |
32 |
--- a/lib/portage/dbapi/vartree.py |
33 |
+++ b/lib/portage/dbapi/vartree.py |
34 |
@@ -3475,13 +3475,19 @@ class dblink(object): |
35 |
symlink_collisions = [] |
36 |
destroot = self.settings['ROOT'] |
37 |
totfiles = len(file_list) + len(symlink_list) |
38 |
+ bucksize = 1000 |
39 |
+ buckcnt = int(totfiles / bucksize) |
40 |
+ if buckcnt == 0 or totfiles % bucksize > int(bucksize / 2): |
41 |
+ buckcnt = buckcnt + 1 |
42 |
+ bucksize = int(totfiles / buckcnt) + 1 |
43 |
showMessage(_(" %s checking %d files for package collisions\n") % \ |
44 |
- (colorize("GOOD", "*"), totfiles)) |
45 |
+ (colorize("GOOD", "*"), totfiles)) |
46 |
for i, (f, f_type) in enumerate(chain( |
47 |
((f, "reg") for f in file_list), |
48 |
((f, "sym") for f in symlink_list))): |
49 |
- if i % 1000 == 0 and i != 0: |
50 |
- showMessage(_("%d files remaining ...\n") % (totfiles - i)) |
51 |
+ if i % bucksize == 0 and i != 0: |
52 |
+ showMessage(_("%3d%% done, %d files remaining ...\n") % |
53 |
+ (i * 100 / totfiles, totfiles - i)) |
54 |
|
55 |
dest_path = normalize_path( |
56 |
os.path.join(destroot, f.lstrip(os.path.sep))) |
57 |
@@ -3570,6 +3576,8 @@ class dblink(object): |
58 |
break |
59 |
if stopmerge: |
60 |
collisions.append(f) |
61 |
+ if bucksize < totfiles: |
62 |
+ showMessage(_("100% done\n")) |
63 |
return collisions, dirs_ro, symlink_collisions, plib_collisions |
64 |
|
65 |
def _lstat_inode_map(self, path_iter): |
66 |
-- |
67 |
2.20.1 |