Revert "[entropy.db] raise RepositoryLocked if repository is locked, on validate()"

This reverts commit f4648760ba.
This commit is contained in:
Fabio Erculiani
2011-03-05 12:38:30 +01:00
parent f4648760ba
commit a89d9b3a09
+6 -15
View File
@@ -40,8 +40,7 @@ from entropy.const import etpConst, const_setup_file, \
const_isunicode, const_convert_to_unicode, const_get_buffer, \
const_convert_to_rawstring, const_cmp, const_pid_exists
from entropy.exceptions import SystemDatabaseError, \
OperationNotPermitted, RepositoryPluginError, SPMError, \
RepositoryLocked
OperationNotPermitted, RepositoryPluginError, SPMError
from entropy.output import brown, bold, red, blue, purple, darkred, darkgreen
from entropy.cache import EntropyCacher, MtimePingus
from entropy.spm.plugins.factory import get_default_instance as get_spm
@@ -656,7 +655,7 @@ class EntropyRepository(EntropyRepositoryBase):
if conn is None:
# check_same_thread still required for conn.close() called from
# arbitrary thread
conn = dbapi2.connect(self._db_path, timeout=5.0,
conn = dbapi2.connect(self._db_path, timeout=10.0,
check_same_thread = False)
self.__connection_cache[c_key] = conn
return conn
@@ -4852,18 +4851,10 @@ class EntropyRepository(EntropyRepositoryBase):
pingus.ping(action_str)
mytxt = "Repository is corrupted, missing SQL tables!"
try:
cur = self._cursor().execute("""
SELECT count(name) FROM SQLITE_MASTER WHERE type = "table" AND (
name = "extrainfo" OR name = "baseinfo" OR name = "keywords")
""")
except OperationalError as err:
if str(err) == "database is locked":
# usually, this should never happen because applications
# should have acquired the read lock of the Entropy resources
# lock.
raise RepositoryLocked(str(err))
raise
cur = self._cursor().execute("""
SELECT count(name) FROM SQLITE_MASTER WHERE type = "table" AND (
name = "extrainfo" OR name = "baseinfo" OR name = "keywords")
""")
rslt = cur.fetchone()
if rslt is None:
raise SystemDatabaseError(mytxt)