1 |
On 1/7/19 6:31 AM, Fabian Groffen wrote: |
2 |
> The reporting of files remaining can look somewhat odd since the report |
3 |
> interval is hardcoded to be per 1000 objects. Adjust this interval to |
4 |
> be regular towards the end. While at it, report percentage done. |
5 |
> |
6 |
> Output before this patch: |
7 |
> |
8 |
> * checking 6111 files for package collisions |
9 |
> 5111 files remaining ... |
10 |
> 4111 files remaining ... |
11 |
> 3111 files remaining ... |
12 |
> 2111 files remaining ... |
13 |
> 1111 files remaining ... |
14 |
> 111 files remaining ... |
15 |
> |
16 |
> After: |
17 |
> |
18 |
> * checking 6158 files for package collisions |
19 |
> 16% done, 5131 files remaining ... |
20 |
> 33% done, 4104 files remaining ... |
21 |
> 50% done, 3077 files remaining ... |
22 |
> 66% done, 2050 files remaining ... |
23 |
> 83% done, 1023 files remaining ... |
24 |
> |
25 |
> Signed-off-by: Fabian Groffen <grobian@g.o> |
26 |
> --- |
27 |
> lib/portage/dbapi/vartree.py | 10 ++++++++-- |
28 |
> 1 file changed, 8 insertions(+), 2 deletions(-) |
29 |
> |
30 |
> diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py |
31 |
> index 4b91caea8..4d0bf2789 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 |
> for i, (f, f_type) in enumerate(chain( |
46 |
> ((f, "reg") for f in file_list), |
47 |
> ((f, "sym") for f in symlink_list))): |
48 |
> - if i % 1000 == 0 and i != 0: |
49 |
> - showMessage(_("%d files remaining ...\n") % (totfiles - i)) |
50 |
> + if i % bucksize == 0 and i != 0: |
51 |
> + showMessage(_("%2d%% done, %d files remaining ...\n") % |
52 |
> + (i * 100 / totfiles, totfiles - i)) |
53 |
> |
54 |
> dest_path = normalize_path( |
55 |
> os.path.join(destroot, f.lstrip(os.path.sep))) |
56 |
> |
57 |
|
58 |
Looks good, please merge. |
59 |
-- |
60 |
Thanks, |
61 |
Zac |