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 AA90F138334 for ; Tue, 8 Jan 2019 13:42:42 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 46E8DE0B2E; Tue, 8 Jan 2019 13:42:40 +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 12103E0B2E for ; Tue, 8 Jan 2019 13:42:39 +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=Ydh2K2pMklrtJKCzae64hzl4hAO73QcdWhbJCc/VSfw=; b=x6fYzzCNP/tpsNlRCkcPx5G28L OEJXGJLohrGqaPasRMpm64lvX7DbirAb0Ns6xOe+vyJ1EL6aJBeY0E4Zv8t+hDcgHSE57pU7lhF5H WyzOfMkuU8JokRpVqubQ2XwVy+Wxf4R7iEHMyej8JoBwq/KEXOiLCz5QuTkM3vySpLYM=; 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 1ggreN-00080q-B6; Tue, 08 Jan 2019 14:42:36 +0100 From: Fabian Groffen To: gentoo-portage-dev@lists.gentoo.org Cc: Fabian Groffen Subject: [gentoo-portage-dev] [PATCH v3] collision_protect: use dynamic report interval Date: Tue, 8 Jan 2019 14:42:08 +0100 Message-Id: <20190108134207.15339-1-grobian@gentoo.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107143113.7068-1-grobian@gentoo.org> References: <20190107143113.7068-1-grobian@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: 1f28d92d-b73f-42ae-bbdd-c1dc89fa1370 X-Archives-Hash: 8a0977eba2b102280e3282097832f185 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 time based. This means that modern (fast) machines likely will never see the countdown messages at all. On slow setups the message will be informative that there is progress, albeit rather slowly. While at it, report percentage done. Output before this patch: * checking 6158 files for package collisions 5158 files remaining ... 4158 files remaining ... 3158 files remaining ... 2158 files remaining ... 1158 files remaining ... 158 files remaining ... Possible output after this patch on a slower machine: * checking 6158 files for package collisions 48% done, 3145 files remaining ... 96% done, 192 files remaining ... 100% done Signed-off-by: Fabian Groffen --- lib/portage/dbapi/vartree.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py index 4b91caea8..244195fad 100644 --- a/lib/portage/dbapi/vartree.py +++ b/lib/portage/dbapi/vartree.py @@ -3475,13 +3475,18 @@ class dblink(object): symlink_collisions = [] destroot = self.settings['ROOT'] totfiles = len(file_list) + len(symlink_list) + tnow = time.time() + tinterv = 2 # seconds + ninterv = tnow + tinterv 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 time.time() > ninterv: + showMessage(_("%3d%% done, %d files remaining ...\n") % + (i * 100 / totfiles, totfiles - i)) + ninterv = time.time() + tinterv dest_path = normalize_path( os.path.join(destroot, f.lstrip(os.path.sep))) @@ -3570,6 +3575,8 @@ class dblink(object): break if stopmerge: collisions.append(f) + if tnow + tinterv < ninterv: + showMessage(_("100% done\n")) return collisions, dirs_ro, symlink_collisions, plib_collisions def _lstat_inode_map(self, path_iter): -- 2.20.1