From 06884685af17f61a2afd20aabaf37b3cbd73d1ce Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@cd1c1023-2f26-0410-ae45-c471fc1f0318> Date: Wed, 23 Jan 2008 14:17:06 +0000 Subject: [PATCH] - implemented a better way to look for needed table - fixed a possible crash caused by exceptions in config protection retrieval git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@1085 cd1c1023-2f26-0410-ae45-c471fc1f0318 --- TODO | 1 - libraries/databaseTools.py | 10 ++++++++++ libraries/entropy.py | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index 8b7aa783a..50dbe075a 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,4 @@ TODO list: - - check mail error (*) - update progress in calculating removal (*) - change package naming format adding category - migrate server code to ServerInterface diff --git a/libraries/databaseTools.py b/libraries/databaseTools.py index fff3e397b..b81a158ec 100644 --- a/libraries/databaseTools.py +++ b/libraries/databaseTools.py @@ -2359,6 +2359,9 @@ class etpDatabase(TextInterface): def retrieveNeeded(self, idpackage): + if not self.doesNeededExist(): + self.createNeededTable() + self.cursor.execute('SELECT library FROM needed,neededreference WHERE needed.idpackage = (?) and needed.idneeded = neededreference.idneeded', (idpackage,)) needed = self.fetchall2set(self.cursor.fetchall()) @@ -3244,6 +3247,13 @@ class etpDatabase(TextInterface): if rslt == None: raise exceptionTools.SystemDatabaseError("SystemDatabaseError: table extrainfo not found. Either does not exist or corrupted.") + def doesNeededExist(self): + self.cursor.execute('select name from SQLITE_MASTER where type = (?) and name = (?)', ("table","needed")) + rslt = self.cursor.fetchone() + if rslt == None: + return False + return True + def tablesChecksum(self): # NOTE: if you will add dependstable to the validation # please have a look at EquoInterface.__install_package_into_database world calculation cache stuff diff --git a/libraries/entropy.py b/libraries/entropy.py index 90d81e1a6..88badd79e 100644 --- a/libraries/entropy.py +++ b/libraries/entropy.py @@ -2708,6 +2708,7 @@ class PackageInterface: # -- CONFIGURATION FILE PROTECTION -- protected = False + tofile_before_protect = tofile try: for x in protect: @@ -2761,6 +2762,8 @@ class PackageInterface: # -- CONFIGURATION FILE PROTECTION -- except Exception, e: + protected = False # safely revert to false + tofile = tofile_before_protect self.Entropy.updateProgress( red("QA: ")+brown("cannot check CONFIG PROTECTION. Exception: %s :: error: %s" % ( str(Exception),