added a workaround to handle tbz2s without COUNTER

git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@808 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
(no author)
2007-12-06 20:11:06 +00:00
parent 90fc065662
commit 285308f0dc
4 changed files with 33 additions and 7 deletions
+22 -4
View File
@@ -616,8 +616,22 @@ class etpDatabase:
)
)
# counter, if != -1
etpData['counter'] = int(etpData['counter']) # cast to integer
if etpData['counter'] != -1:
if etpData['counter'] <= -2:
# special cases
try:
mycounters = list(self.listAllCounters(onlycounters = True))
mycounter = min(mycounters)
if mycounter >= -1:
etpData['counter'] = -2
else:
etpData['counter'] = mycounter-1
except:
etpData['counter'] = -2
try:
self.cursor.execute(
'INSERT into counters VALUES '
@@ -2601,10 +2615,14 @@ class etpDatabase:
self.cursor.execute('SELECT atom,idpackage,branch FROM baseinfo')
return self.cursor.fetchall()
def listAllCounters(self):
def listAllCounters(self, onlycounters = False):
dbLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"listAllCounters: called.")
self.cursor.execute('SELECT counter,idpackage FROM counters')
return self.cursor.fetchall()
if onlycounters:
self.cursor.execute('SELECT counter FROM counters')
return self.fetchall2set(self.cursor.fetchall())
else:
self.cursor.execute('SELECT counter,idpackage FROM counters')
return self.cursor.fetchall()
def listAllIdpackages(self, branch = None):
dbLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"listAllIdpackages: called.")