Entropy/EquoInterface:

- do not trash info cache when adding/removing packages cause we're fine with idpackages now

git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@1643 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
lxnay
2008-04-09 18:59:26 +00:00
parent 045bc12b2b
commit edcd402a71
2 changed files with 18 additions and 15 deletions
+5 -4
View File
@@ -395,7 +395,7 @@ class etpDatabase:
clientDbconn.setRepositoryUpdatesDigest(repository, stored_digest)
# clear client cache
clientDbconn.clearCache()
clientDbconn.clearCache(all = True)
# this functions will filter either data from /usr/portage/profiles/updates/*
# or repository database returning only the needed actions
@@ -459,7 +459,7 @@ class etpDatabase:
self.runTreeUpdatesSlotmoveAction(command[1:])
# discard cache
self.clearCache()
self.clearCache(all = True)
# -- move action:
@@ -1685,7 +1685,7 @@ class etpDatabase:
def fetchone2set(self, item):
return set(item)
def clearCache(self):
def clearCache(self, all = False):
self.live_cache.clear()
def do_clear(name):
dump_path = os.path.join(etpConst['dumpstoragedir'],name)
@@ -1695,7 +1695,8 @@ class etpDatabase:
item = os.path.join(dump_dir,item)
if os.path.isfile(item):
os.remove(item)
do_clear(etpCache['dbInfo']+"/"+self.dbname+"/")
if all:
do_clear(etpCache['dbInfo']+"/"+self.dbname+"/")
do_clear(etpCache['dbMatch']+"/"+self.dbname+"/")
do_clear(etpCache['dbSearch']+"/"+self.dbname+"/")
+13 -11
View File
@@ -225,7 +225,7 @@ class EquoInterface(TextInterface):
if cached == None:
# invalidate matching cache
try:
self.repository_move_clear_cache()
self.repository_move_clear_cache(all = True)
except IOError:
pass
elif type(cached) is tuple:
@@ -237,7 +237,7 @@ class EquoInterface(TextInterface):
difflist = cached - myrepolist # before minus now
for repoid in difflist:
try:
self.repository_move_clear_cache(repoid)
self.repository_move_clear_cache(repoid, all = True)
except IOError:
pass
try:
@@ -1190,7 +1190,7 @@ class EquoInterface(TextInterface):
return dbpkginfo
def repository_move_clear_cache(self, repoid = None):
def repository_move_clear_cache(self, repoid = None, all = False):
self.clear_dump_cache(etpCache['world_available'])
self.clear_dump_cache(etpCache['world_update'])
self.clear_dump_cache(etpCache['check_package_update'])
@@ -1199,7 +1199,8 @@ class EquoInterface(TextInterface):
self.clear_dump_cache(etpCache['dep_tree'])
if repoid != None:
self.clear_dump_cache(etpCache['dbMatch']+"/"+repoid+"/")
self.clear_dump_cache(etpCache['dbInfo']+"/"+repoid+"/") # it also contains package masking information
if all:
self.clear_dump_cache(etpCache['dbInfo']+"/"+repoid+"/")
self.clear_dump_cache(etpCache['dbSearch']+"/"+repoid+"/")
@@ -1259,7 +1260,7 @@ class EquoInterface(TextInterface):
if repoid in etpRepositoriesOrder:
etpRepositoriesOrder.remove(repoid)
self.repository_move_clear_cache(repoid)
self.repository_move_clear_cache(repoid, all = True)
# save new etpRepositories to file
repodata = {}
repodata['repoid'] = repoid
@@ -1278,7 +1279,7 @@ class EquoInterface(TextInterface):
self.repository_move_clear_cache(repoid)
def enableRepository(self, repoid):
self.repository_move_clear_cache(repoid)
self.repository_move_clear_cache(repoid, all = True)
# save new etpRepositories to file
repodata = {}
repodata['repoid'] = repoid
@@ -3739,8 +3740,6 @@ class PackageInterface:
self.Entropy.clear_dump_cache(etpCache['dep_tree'])
self.Entropy.clear_dump_cache(etpCache['dbMatch']+etpConst['clientdbid']+"/")
self.Entropy.clear_dump_cache(etpCache['dbSearch']+etpConst['clientdbid']+"/")
if self.infoDict['removeidpackage'] != -1:
self.Entropy.clear_dump_cache(etpCache['dbInfo']+"/"+etpConst['clientdbid']+"/"+str(self.infoDict['removeidpackage'])+"/")
self.__update_available_cache()
try:
@@ -5288,7 +5287,10 @@ class RepoInterface:
def clear_repository_cache(self, repo):
self.__validate_repository_id(repo)
self.Entropy.clear_dump_cache(etpCache['dbInfo']+"/"+repo+"/")
# there is no need to remove dbInfo because
# idpackages are PRIMARY KEY AUTOINCREMENT, so
# an idpackage won't be used more than once
#self.Entropy.clear_dump_cache(etpCache['dbInfo']+"/"+repo+"/")
self.Entropy.clear_dump_cache(etpCache['dbMatch']+repo+"/")
self.Entropy.clear_dump_cache(etpCache['dbSearch']+repo+"/")
@@ -8167,10 +8169,10 @@ class PackageMaskingParser:
def __removeRepoCache(self, repoid = None):
if os.path.isdir(etpConst['dumpstoragedir']):
if repoid:
self.Entropy.repository_move_clear_cache(repoid)
self.Entropy.repository_move_clear_cache(repoid, all = True)
else:
for repoid in etpRepositoriesOrder:
self.Entropy.repository_move_clear_cache(repoid)
self.Entropy.repository_move_clear_cache(repoid, all = True)
else:
os.makedirs(etpConst['dumpstoragedir'])