From 4df9b526bcf31fb703fa9231f283c778e772c1a8 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 18 Jul 2008 07:47:12 +0000 Subject: Suppress counter initialization warning messages in vardbapi.get_counter_tick_core() in cases when the vdb is empty. This avoids pointless error messages when merging packages into a new root, like when building stage 1. svn path=/main/trunk/; revision=11123 --- pym/portage/dbapi/vartree.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index b6b2dbf1a..f9e3fc9ed 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -846,13 +846,16 @@ class vardbapi(dbapi): if counter > max_counter: max_counter = counter + new_vdb = False counter = -1 try: cfile = open(self._counter_path, "r") except EnvironmentError, e: - writemsg("!!! Unable to read COUNTER file: '%s'\n" % \ - self._counter_path, noiselevel=-1) - writemsg("!!! %s\n" % str(e), noiselevel=-1) + new_vdb = not bool(self.cpv_all()) + if not new_vdb: + writemsg("!!! Unable to read COUNTER file: '%s'\n" % \ + self._counter_path, noiselevel=-1) + writemsg("!!! %s\n" % str(e), noiselevel=-1) del e else: try: @@ -877,7 +880,7 @@ class vardbapi(dbapi): if counter > max_counter: max_counter = counter - if counter < 0: + if counter < 0 and not new_vdb: writemsg("!!! Initializing COUNTER to " + \ "value of %d\n" % max_counter, noiselevel=-1) -- cgit v1.2.3-1-g7c22