diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-10-21 21:05:18 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-10-21 21:05:18 +0000 |
commit | c1183d40ce64c1c750fc7022234abd1538c0467b (patch) | |
tree | a6c2efe0a1f03b3dcda1e68d81d5b92e8240e6e1 /pym/portage/dbapi/vartree.py | |
parent | 9ac3e9b4560f6e1ca3e47979cf2aa2abfe0749b0 (diff) | |
download | portage-c1183d40ce64c1c750fc7022234abd1538c0467b.tar.gz portage-c1183d40ce64c1c750fc7022234abd1538c0467b.tar.bz2 portage-c1183d40ce64c1c750fc7022234abd1538c0467b.zip |
Remove needlessly complex error handling code from vardbapi.cpv_counter().
svn path=/main/trunk/; revision=11711
Diffstat (limited to 'pym/portage/dbapi/vartree.py')
-rw-r--r-- | pym/portage/dbapi/vartree.py | 51 |
1 files changed, 4 insertions, 47 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index ceae2ff31..6bc960ff0 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -672,53 +672,10 @@ class vardbapi(dbapi): return long(self.aux_get(mycpv, ["COUNTER"])[0]) except (KeyError, ValueError): pass - cdir = self.getpath(mycpv) - cpath = self.getpath(mycpv, filename="COUNTER") - - # We write our new counter value to a new file that gets moved into - # place to avoid filesystem corruption on XFS (unexpected reboot.) - corrupted = 0 - if os.path.exists(cpath): - cfile = open(cpath, "r") - try: - counter = long(cfile.readline()) - except ValueError: - print "portage: COUNTER for", mycpv, "was corrupted; resetting to value of 0" - counter = long(0) - corrupted = 1 - cfile.close() - elif os.path.exists(cdir): - mys = pkgsplit(mycpv) - myl = self.match(mys[0], use_cache=0) - print mys, myl - if len(myl) == 1: - try: - # Only one package... Counter doesn't matter. - write_atomic(cpath, "1") - counter = 1 - except SystemExit, e: - raise - except Exception, e: - writemsg("!!! COUNTER file is missing for "+str(mycpv)+" in /var/db.\n", - noiselevel=-1) - writemsg("!!! Please run %s/fix-db.py or\n" % PORTAGE_BIN_PATH, - noiselevel=-1) - writemsg("!!! unmerge this exact version.\n", noiselevel=-1) - writemsg("!!! %s\n" % e, noiselevel=-1) - sys.exit(1) - else: - writemsg("!!! COUNTER file is missing for "+str(mycpv)+" in /var/db.\n", - noiselevel=-1) - writemsg("!!! Please run %s/fix-db.py or\n" % PORTAGE_BIN_PATH, - noiselevel=-1) - writemsg("!!! remerge the package.\n", noiselevel=-1) - sys.exit(1) - else: - counter = long(0) - if corrupted: - # update new global counter file - write_atomic(cpath, str(counter)) - return counter + writemsg_level(("portage: COUNTER for %s was corrupted; " + \ + "resetting to value of 0\n") % (mycpv,), + level=logging.ERROR, noiselevel=-1) + return 0 def cpv_inject(self, mycpv): "injects a real package into our on-disk database; assumes mycpv is valid and doesn't already exist" |