From: Zac Medico <zmedico@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org, Fabian Groffen <grobian@gentoo.org>
Subject: Re: [gentoo-portage-dev] [PATCH] lib/portage/dbapi/vartree: use dynamic report interval in _collision_protect
Date: Mon, 7 Jan 2019 10:54:27 -0800 [thread overview]
Message-ID: <cf646f36-e5f4-8737-667e-f0aa9d7edf28@gentoo.org> (raw)
In-Reply-To: <20190107143113.7068-1-grobian@gentoo.org>
[-- Attachment #1.1: Type: text/plain, Size: 2171 bytes --]
On 1/7/19 6:31 AM, Fabian Groffen wrote:
> The reporting of files remaining can look somewhat odd since the report
> interval is hardcoded to be per 1000 objects. Adjust this interval to
> be regular towards the end. While at it, report percentage done.
>
> Output before this patch:
>
> * checking 6111 files for package collisions
> 5111 files remaining ...
> 4111 files remaining ...
> 3111 files remaining ...
> 2111 files remaining ...
> 1111 files remaining ...
> 111 files remaining ...
>
> After:
>
> * checking 6158 files for package collisions
> 16% done, 5131 files remaining ...
> 33% done, 4104 files remaining ...
> 50% done, 3077 files remaining ...
> 66% done, 2050 files remaining ...
> 83% done, 1023 files remaining ...
>
> Signed-off-by: Fabian Groffen <grobian@gentoo.org>
> ---
> lib/portage/dbapi/vartree.py | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py
> index 4b91caea8..4d0bf2789 100644
> --- a/lib/portage/dbapi/vartree.py
> +++ b/lib/portage/dbapi/vartree.py
> @@ -3475,13 +3475,19 @@ class dblink(object):
> symlink_collisions = []
> destroot = self.settings['ROOT']
> totfiles = len(file_list) + len(symlink_list)
> + bucksize = 1000
> + buckcnt = int(totfiles / bucksize)
> + if buckcnt == 0 or totfiles % bucksize > int(bucksize / 2):
> + buckcnt = buckcnt + 1
> + bucksize = int(totfiles / buckcnt) + 1
> showMessage(_(" %s checking %d files for package collisions\n") % \
> (colorize("GOOD", "*"), totfiles))
> for i, (f, f_type) in enumerate(chain(
> ((f, "reg") for f in file_list),
> ((f, "sym") for f in symlink_list))):
> - if i % 1000 == 0 and i != 0:
> - showMessage(_("%d files remaining ...\n") % (totfiles - i))
> + if i % bucksize == 0 and i != 0:
> + showMessage(_("%2d%% done, %d files remaining ...\n") %
> + (i * 100 / totfiles, totfiles - i))
>
> dest_path = normalize_path(
> os.path.join(destroot, f.lstrip(os.path.sep)))
>
Looks good, please merge.
--
Thanks,
Zac
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 981 bytes --]
next prev parent reply other threads:[~2019-01-07 18:54 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-07 14:31 [gentoo-portage-dev] [PATCH] lib/portage/dbapi/vartree: use dynamic report interval in _collision_protect Fabian Groffen
2019-01-07 18:54 ` Zac Medico [this message]
2019-01-07 19:05 ` Michał Górny
2019-01-08 8:09 ` [gentoo-portage-dev] [PATCH] collision_protect: use dynamic report interval Fabian Groffen
2019-01-08 8:17 ` Ulrich Mueller
2019-01-08 8:18 ` Fabian Groffen
2019-01-08 13:42 ` [gentoo-portage-dev] [PATCH v3] " Fabian Groffen
2019-01-08 19:15 ` Zac Medico
2019-01-08 20:59 ` M. J. Everitt
2019-01-09 8:09 ` Fabian Groffen
2019-01-09 8:33 ` [gentoo-portage-dev] [PATCH v4] " Fabian Groffen
2019-01-10 5:22 ` Zac Medico
2019-01-10 8:22 ` Fabian Groffen
2019-01-10 15:30 ` [gentoo-portage-dev] [PATCH v5] " Fabian Groffen
2019-01-11 4:37 ` Zac Medico
2019-01-11 10:16 ` Fabian Groffen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cf646f36-e5f4-8737-667e-f0aa9d7edf28@gentoo.org \
--to=zmedico@gentoo.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
--cc=grobian@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox