diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-06-24 20:43:17 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-06-24 20:43:17 +0000 |
commit | b7a09e531f0c50aa48a1db3271cdab0166c2ee3e (patch) | |
tree | 67831bfdcab6a3869f5dad199444622aa368cf40 | |
parent | a7cfc5a30f702052de3fc87dfb657175e764d5b0 (diff) | |
download | portage-b7a09e531f0c50aa48a1db3271cdab0166c2ee3e.tar.gz portage-b7a09e531f0c50aa48a1db3271cdab0166c2ee3e.tar.bz2 portage-b7a09e531f0c50aa48a1db3271cdab0166c2ee3e.zip |
Make the COUNTER regeneration logic account for $ROOT as per bug #129054.
svn path=/main/trunk/; revision=3644
-rw-r--r-- | pym/portage.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pym/portage.py b/pym/portage.py index 6f6371991..417f62b94 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -4169,13 +4169,16 @@ class dbapi: # We write our new counter value to a new file that gets moved into # place to avoid filesystem corruption. + find_counter = ("find '%s' -type f -name COUNTER | " + \ + "while read f; do echo $(<\"${f}\"); done | " + \ + "sort -n | tail -n1") % os.path.join(self.root, VDB_PATH) if os.path.exists(cpath): cfile=open(cpath, "r") try: counter=long(cfile.readline()) except (ValueError,OverflowError): try: - counter=long(commands.getoutput("for FILE in $(find /"+VDB_PATH+" -type f -name COUNTER); do echo $(<${FILE}); done | sort -n | tail -n1 | tr -d '\n'")) + counter = long(commands.getoutput(find_counter).strip()) writemsg("!!! COUNTER was corrupted; resetting to value of %d\n" % counter, noiselevel=-1) changed=1 @@ -4189,7 +4192,7 @@ class dbapi: cfile.close() else: try: - counter=long(commands.getoutput("for FILE in $(find /"+VDB_PATH+" -type f -name COUNTER); do echo $(<${FILE}); done | sort -n | tail -n1 | tr -d '\n'")) + counter = long(commands.getoutput(find_counter).strip()) writemsg("!!! Global counter missing. Regenerated from counter files to: %s\n" % counter, noiselevel=-1) except SystemExit, e: |