From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 097D9138334 for ; Tue, 8 Jan 2019 08:09:39 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B48C8E09A5; Tue, 8 Jan 2019 08:09:37 +0000 (UTC) Received: from ptah.cheops.bitzolder.nl (ptah.cheops.bitzolder.nl [IPv6:2001:980:3ff0::65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 79200E09A5 for ; Tue, 8 Jan 2019 08:09:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=bitzolder.nl; s=cheops; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=c93uXUeq2zIXzPAbX40L56bQaTctEEjiV4YnFhgdJn4=; b=Gpw5W+qPkNYgziv44K9fO1YyUS 1yBUVcpzXUTm92myFB8AcoEM2SxgAiFM/xn9IFrm7kUhhWo6EMCoVq2XOZEfOhsZTINL8cHTm9Q/A PuzpijyV6eeamMX1V/BMH5tnnJiY7F5PpmEX8al670iuOK0iHiEr2/P7JgkqPLxrl9R0=; Received: from hollandscheleeuw.cheops.bitzolder.nl ([2001:980:3ff0:64:5054:ff:fe0b:7015]) by ptah.cheops.bitzolder.nl with esmtp (Exim 4.91) (envelope-from ) id 1ggmS2-0003E2-8R; Tue, 08 Jan 2019 09:09:31 +0100 From: Fabian Groffen To: gentoo-portage-dev@lists.gentoo.org Cc: Fabian Groffen Subject: [gentoo-portage-dev] [PATCH] collision_protect: use dynamic report interval Date: Tue, 8 Jan 2019 09:09:09 +0100 Message-Id: <20190108080909.25947-1-grobian@gentoo.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <1546887921.860.16.camel@gentoo.org> References: <1546887921.860.16.camel@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: SpamAssassin/ClamAV at ptah.cheops.bitzolder.nl X-Archives-Salt: 8575dc55-b20f-4125-81d1-da903ffee988 X-Archives-Hash: 5c1490750f5e80f8519714d9103a7759 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 ... 100% done Signed-off-by: Fabian Groffen --- lib/portage/dbapi/vartree.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py index 4b91caea8..78f2b37f2 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)) + (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(_("%3d%% done, %d files remaining ...\n") % + (i * 100 / totfiles, totfiles - i)) dest_path = normalize_path( os.path.join(destroot, f.lstrip(os.path.sep))) @@ -3570,6 +3576,8 @@ class dblink(object): break if stopmerge: collisions.append(f) + if bucksize < totfiles: + showMessage(_("100% done\n")) return collisions, dirs_ro, symlink_collisions, plib_collisions def _lstat_inode_map(self, path_iter): -- 2.20.1