1 |
Pushed, thanks |
2 |
|
3 |
On 10-01-2019 20:37:16 -0800, Zac Medico wrote: |
4 |
> On 1/10/19 7:30 AM, Fabian Groffen wrote: |
5 |
> > The reporting of files remaining can look somewhat odd since the report |
6 |
> > interval is hardcoded to be per 1000 objects. Adjust this interval to |
7 |
> > be time based. This means that modern (fast) machines likely will never |
8 |
> > see the countdown messages at all. On slow setups the message will be |
9 |
> > informative that there is progress, albeit rather slowly. While at it, |
10 |
> > report percentage done. |
11 |
> > |
12 |
> > Output before this patch: |
13 |
> > |
14 |
> > * checking 6158 files for package collisions |
15 |
> > 5158 files remaining ... |
16 |
> > 4158 files remaining ... |
17 |
> > 3158 files remaining ... |
18 |
> > 2158 files remaining ... |
19 |
> > 1158 files remaining ... |
20 |
> > 158 files remaining ... |
21 |
> > |
22 |
> > Possible output after this patch on a slower machine: |
23 |
> > |
24 |
> > * checking 6158 files for package collisions |
25 |
> > 48% done, 3145 files remaining ... |
26 |
> > 96% done, 192 files remaining ... |
27 |
> > 100% done |
28 |
> > |
29 |
> > Signed-off-by: Fabian Groffen <grobian@g.o> |
30 |
> > --- |
31 |
> > lib/portage/dbapi/vartree.py | 15 +++++++++++++-- |
32 |
> > 1 file changed, 13 insertions(+), 2 deletions(-) |
33 |
> > |
34 |
> > diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py |
35 |
> > index 4b91caea8..909c0e473 100644 |
36 |
> > --- a/lib/portage/dbapi/vartree.py |
37 |
> > +++ b/lib/portage/dbapi/vartree.py |
38 |
> > @@ -35,6 +35,7 @@ portage.proxy.lazyimport.lazyimport(globals(), |
39 |
> > 'portage.util.install_mask:install_mask_dir,InstallMask', |
40 |
> > 'portage.util.listdir:dircache,listdir', |
41 |
> > 'portage.util.movefile:movefile', |
42 |
> > + 'portage.util.monotonic:monotonic', |
43 |
> > 'portage.util.path:first_existing,iter_parents', |
44 |
> > 'portage.util.writeable_check:get_ro_checker', |
45 |
> > 'portage.util._xattr:xattr', |
46 |
> > @@ -3475,13 +3476,21 @@ class dblink(object): |
47 |
> > symlink_collisions = [] |
48 |
> > destroot = self.settings['ROOT'] |
49 |
> > totfiles = len(file_list) + len(symlink_list) |
50 |
> > + previous = monotonic() |
51 |
> > + progress_shown = False |
52 |
> > + report_interval = 1.7 # seconds |
53 |
> > + falign = len("%d" % totfiles) |
54 |
> > showMessage(_(" %s checking %d files for package collisions\n") % \ |
55 |
> > (colorize("GOOD", "*"), totfiles)) |
56 |
> > for i, (f, f_type) in enumerate(chain( |
57 |
> > ((f, "reg") for f in file_list), |
58 |
> > ((f, "sym") for f in symlink_list))): |
59 |
> > - if i % 1000 == 0 and i != 0: |
60 |
> > - showMessage(_("%d files remaining ...\n") % (totfiles - i)) |
61 |
> > + current = monotonic() |
62 |
> > + if current - previous > report_interval: |
63 |
> > + showMessage(_("%3d%% done, %*d files remaining ...\n") % |
64 |
> > + (i * 100 / totfiles, falign, totfiles - i)) |
65 |
> > + previous = current |
66 |
> > + progress_shown = True |
67 |
> > |
68 |
> > dest_path = normalize_path( |
69 |
> > os.path.join(destroot, f.lstrip(os.path.sep))) |
70 |
> > @@ -3570,6 +3579,8 @@ class dblink(object): |
71 |
> > break |
72 |
> > if stopmerge: |
73 |
> > collisions.append(f) |
74 |
> > + if progress_shown: |
75 |
> > + showMessage(_("100% done\n")) |
76 |
> > return collisions, dirs_ro, symlink_collisions, plib_collisions |
77 |
> > |
78 |
> > def _lstat_inode_map(self, path_iter): |
79 |
> > |
80 |
> |
81 |
> Looks good! |
82 |
> -- |
83 |
> Thanks, |
84 |
> Zac |
85 |
> |
86 |
|
87 |
|
88 |
|
89 |
|
90 |
-- |
91 |
Fabian Groffen |
92 |
Gentoo on a different level |