From b7a09e531f0c50aa48a1db3271cdab0166c2ee3e Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 24 Jun 2006 20:43:17 +0000 Subject: Make the COUNTER regeneration logic account for $ROOT as per bug #129054. svn path=/main/trunk/; revision=3644 --- pym/portage.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'pym') 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: -- cgit v1.2.3-1-g7c22