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 2FD07138334 for ; Wed, 9 Jan 2019 08:33:52 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 15851E0C9E; Wed, 9 Jan 2019 08:33:51 +0000 (UTC) Received: from khnum.cheops.bitzolder.nl (unknown [IPv6:2001:980:3ff0::69]) (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 D7BB6E0C9E for ; Wed, 9 Jan 2019 08:33:50 +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=e67KJP1KVpMsdKqu9vdnIXE6iYaPC5i7UHjSif1PIgw=; b=H9K6viCjhhvjpxO7xdh2g3wxd+ JPqncno5holRqj5RnzZhmC8f2Fz25iiJIfyJWwRoqT6MtZO/uNvuC0IrSx5Tb/ao3aOkENuJUey6v Gq84HhpADDOkuh4uhM0LCDYwI1pM9nkbPq9filIjZyAXwck22vJINpgRn8kbc1VV+y+8=; Received: from hollandscheleeuw.cheops.bitzolder.nl ([2001:980:3ff0:64:5054:ff:fe0b:7015]) by khnum.cheops.bitzolder.nl with esmtp (Exim 4.91) (envelope-from ) id 1gh9Iz-0007R4-2u; Wed, 09 Jan 2019 09:33:43 +0100 From: Fabian Groffen To: gentoo-portage-dev@lists.gentoo.org Cc: Fabian Groffen Subject: [gentoo-portage-dev] [PATCH v4] collision_protect: use dynamic report interval Date: Wed, 9 Jan 2019 09:33:24 +0100 Message-Id: <20190109083323.3590-1-grobian@gentoo.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190108134207.15339-1-grobian@gentoo.org> References: <20190108134207.15339-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 khnum.cheops.bitzolder.nl X-Archives-Salt: 75cfd415-74db-4bba-adfe-5cae4dd6c2c3 X-Archives-Hash: f7445e6d00c5add62bae909f254967fe 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 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py index 4b91caea8..df192e6fc 100644 --- a/lib/portage/dbapi/vartree.py +++ b/lib/portage/dbapi/vartree.py @@ -35,6 +35,7 @@ portage.proxy.lazyimport.lazyimport(globals(), 'portage.util.install_mask:install_mask_dir,InstallMask', 'portage.util.listdir:dircache,listdir', 'portage.util.movefile:movefile', + 'portage.util.monotonic:monotonic', 'portage.util.path:first_existing,iter_parents', 'portage.util.writeable_check:get_ro_checker', 'portage.util._xattr:xattr', @@ -3475,13 +3476,19 @@ class dblink(object): symlink_collisions = [] destroot = self.settings['ROOT'] totfiles = len(file_list) + len(symlink_list) + tnow = monotonic() + tinterv = 2 # seconds + ninterv = tnow + tinterv + falign = len("%d" % totfiles) 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 monotonic() > ninterv: + showMessage(_("%3d%% done, %*d files remaining ...\n") % + (falign, i * 100 / totfiles, totfiles - i)) + ninterv = monotonic() + tinterv dest_path = normalize_path( os.path.join(destroot, f.lstrip(os.path.sep))) @@ -3570,6 +3577,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