introducing On-Disk Cache
git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@560 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
4
TODO
4
TODO
@@ -1,8 +1,7 @@
|
||||
TODO list:
|
||||
- reagent: complete smartapps section
|
||||
CLIENT:
|
||||
- on disk caching for all user commands
|
||||
- implement logTools into new Equo functions (especially messages)
|
||||
- implement logTools into new Equo functions (especially messages) --> messages should go into equo.log
|
||||
- during removal/add handle (trigger functions):
|
||||
- complete preremove()
|
||||
- complete postremove()
|
||||
@@ -21,6 +20,7 @@ TODO list:
|
||||
- equo conf update:
|
||||
- automerge trivial changes
|
||||
- automerge comments changes
|
||||
- maybe on-disk cache for removal functions?
|
||||
|
||||
Project Status:
|
||||
- entropy: will handle all the three tools below
|
||||
|
||||
@@ -156,6 +156,8 @@ try:
|
||||
if len(scandata) > 0:
|
||||
print_warning(darkgreen("There are "+str(len(scandata))+" configuration file(s) that need(s) to be updated."))
|
||||
print_warning(red("Please run: ")+bold("equo conf update"))
|
||||
# save caches
|
||||
equoTools.saveCaches()
|
||||
sys.exit(rc)
|
||||
|
||||
elif (options[0] == "query"):
|
||||
|
||||
@@ -33,6 +33,7 @@ from entropyTools import unpackGzip, compareMd5, bytesIntoHuman, convertUnixTime
|
||||
from databaseTools import etpDatabase
|
||||
import triggerTools
|
||||
import confTools
|
||||
import dumpTools
|
||||
import xpak
|
||||
import time
|
||||
|
||||
@@ -40,14 +41,20 @@ import time
|
||||
import logTools
|
||||
equoLog = logTools.LogFile(level = etpConst['equologlevel'],filename = etpConst['equologfile'], header = "[Equo]")
|
||||
|
||||
global atomMatchCache
|
||||
atomMatchCache = {}
|
||||
global atomClientMatchCache
|
||||
atomClientMatchCache = {}
|
||||
global contentCache
|
||||
contentCache = {}
|
||||
global getDependenciesCache
|
||||
getDependenciesCache = {}
|
||||
### Caching functions
|
||||
|
||||
def loadCaches():
|
||||
print_info(darkred(" @@ ")+blue("Loading On-Disk Cache..."))
|
||||
mycache = dumpTools.loadobj(etpCache['atomMatch'])
|
||||
if isinstance(mycache, dict):
|
||||
global atomMatchCache
|
||||
atomMatchCache = mycache.copy()
|
||||
#print "loadCaches: "+str(len(atomMatchCache))
|
||||
|
||||
def saveCaches():
|
||||
# atomMatchCache
|
||||
dumpTools.dumpobj(etpCache['atomMatch'],atomMatchCache)
|
||||
#print "saveCaches: "+str(len(atomMatchCache))
|
||||
|
||||
########################################################
|
||||
####
|
||||
@@ -206,6 +213,10 @@ def syncRepositories(reponames = [], forceUpdate = False, quiet = False):
|
||||
syncErrors = True
|
||||
continue
|
||||
|
||||
# clear repository cache
|
||||
atomMatchCache.clear()
|
||||
dumpTools.dumpobj(etpCache['atomMatch'],atomMatchCache)
|
||||
|
||||
# starting to download
|
||||
if (not quiet):
|
||||
print_info(red("\tDownloading database ")+darkgreen(etpConst['etpdatabasefilegzip'])+red(" ..."))
|
||||
@@ -1489,9 +1500,6 @@ def installPackageIntoDatabase(idpackage, repository):
|
||||
print "DEBUG!!! dependstable not found"
|
||||
clientDbconn.regenerateDependsTable()
|
||||
|
||||
# reset atomMatch cache
|
||||
atomMatchCache.clear()
|
||||
|
||||
closeClientDatabase(clientDbconn)
|
||||
return exitstatus
|
||||
|
||||
@@ -1520,8 +1528,6 @@ def removePackageFromDatabase(idpackage):
|
||||
pass
|
||||
|
||||
clientDbconn.removePackage(idpackage)
|
||||
# reset atomMatch cache
|
||||
atomMatchCache = {}
|
||||
|
||||
closeClientDatabase(clientDbconn)
|
||||
return 0
|
||||
@@ -1577,10 +1583,12 @@ def package(options):
|
||||
myopts = _myopts
|
||||
|
||||
if (options[0] == "deptest"):
|
||||
loadCaches()
|
||||
rc, garbage = dependenciesTest(quiet = equoRequestQuiet, ask = equoRequestAsk, pretend = equoRequestPretend)
|
||||
|
||||
elif (options[0] == "install"):
|
||||
if len(myopts) > 0:
|
||||
loadCaches()
|
||||
rc, status = installPackages(myopts, ask = equoRequestAsk, pretend = equoRequestPretend, verbose = equoRequestVerbose, deps = equoRequestDeps, emptydeps = equoRequestEmptyDeps, onlyfetch = equoRequestOnlyFetch, deepdeps = equoRequestDeep, configFiles = equoRequestConfigFiles)
|
||||
else:
|
||||
print_error(red(" Nothing to do."))
|
||||
@@ -1592,10 +1600,12 @@ def package(options):
|
||||
for opt in myopts:
|
||||
if opt == "upgrade":
|
||||
doupgrade = True
|
||||
loadCaches()
|
||||
rc, status = worldUpdate(ask = equoRequestAsk, pretend = equoRequestPretend, verbose = equoRequestVerbose, onlyfetch = equoRequestOnlyFetch, upgrade = doupgrade)
|
||||
|
||||
elif (options[0] == "remove"):
|
||||
if len(myopts) > 0:
|
||||
loadCaches()
|
||||
rc, status = removePackages(myopts, ask = equoRequestAsk, pretend = equoRequestPretend, verbose = equoRequestVerbose, deps = equoRequestDeps, deep = equoRequestDeep, configFiles = equoRequestConfigFiles)
|
||||
else:
|
||||
print_error(red(" Nothing to do."))
|
||||
|
||||
@@ -35,6 +35,16 @@ etpInstallTriggers = {}
|
||||
### structure same as above
|
||||
etpRemovalTriggers = {}
|
||||
|
||||
### Application disk cache
|
||||
global atomMatchCache
|
||||
atomMatchCache = {}
|
||||
global atomClientMatchCache
|
||||
atomClientMatchCache = {}
|
||||
global contentCache
|
||||
contentCache = {}
|
||||
global getDependenciesCache
|
||||
getDependenciesCache = {}
|
||||
|
||||
# Client packages/database repositories
|
||||
# used by equo
|
||||
etpRepositories = {}
|
||||
|
||||
@@ -391,6 +391,7 @@ etpConst = {
|
||||
# disk caching dictionary
|
||||
etpCache = {
|
||||
'configfiles': 'scanfs', # used to store information about files that should be merged using "equo conf merge"
|
||||
'atomMatch': 'atomMatchCache', # used to store info about repository dependencies solving
|
||||
}
|
||||
|
||||
# handle Entropy Version
|
||||
|
||||
Reference in New Issue
Block a user