add dependstable support to the server part

git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@470 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
(no author)
2007-09-02 10:52:20 +00:00
parent 5c12400174
commit ebf07f64e9
4 changed files with 39 additions and 4 deletions
+7 -3
View File
@@ -2159,13 +2159,16 @@ def searchDepends(atoms, idreturn = False, verbose = False, quiet = False):
if (not idreturn) and (not quiet):
print_info(yellow(" @@ ")+darkgreen("Depends Search..."))
clientDbconn = openClientDatabase()
dataInfo = [] # when idreturn is True
for atom in atoms:
result = atomMatchInRepository(atom,clientDbconn)
print result
result = atomMatch(atom)
if (result[0] != -1):
searchResults = clientDbconn.searchDepends(result[0])
dbconn = openRepositoryDatabase(result[1])
searchResults = dbconn.searchDepends(result[0])
if searchResults == -2:
# I need to generate dependstable
regenerateDependsTable(clientDbconn)
@@ -2183,6 +2186,7 @@ def searchDepends(atoms, idreturn = False, verbose = False, quiet = False):
else:
printPackageInfo(idpackage, clientDbconn, clientSearch = True, strictOutput = True, quiet = quiet)
clientDbconn.closeDB()
if (idreturn):
@@ -2402,7 +2406,7 @@ def searchDescription(descriptions, idreturn = False, quiet = False):
'''
@description: recreate dependstable table in the client database, it's used for caching searchDepends requests
@description: recreate dependstable table in the chosen database, it's used for caching searchDepends requests
@input Nothing
@output: Nothing
'''
+3
View File
@@ -104,6 +104,9 @@ def database(options):
dbconn.commitChanges()
# regen dependstable
reagentTools.dependsTableInitialize(dbconn, False)
dbconn.closeDB()
print_info(green(" * ")+red("Entropy database has been reinitialized using binary packages available"))
+22
View File
@@ -169,6 +169,10 @@ def enzyme(options):
dbconn.commitChanges()
dbconn.commitChanges()
# regen dependstable
dependsTableInitialize(dbconn, False)
dbconn.closeDB()
print_info(green(" * ")+red("Statistics: ")+blue("Entries created/updated: ")+bold(str(etpCreated))+yellow(" - ")+darkblue("Entries discarded: ")+bold(str(etpNotCreated)))
@@ -630,6 +634,24 @@ def extractPkgData(package, etpBranch = "unstable", structuredLayout = False):
return etpData
def dependsTableInitialize(dbconn = None, runActivator = True):
closedb = False
if dbconn is None:
dbconn = databaseTools.etpDatabase(readOnly = False, noUpload = True)
closedb = True
sys.path.append('../client')
import equoTools
equoTools.regenerateDependsTable(dbconn)
# now taint
dbconn.taintDatabase()
if (closedb):
dbconn.closeDB()
# running activator
if (runActivator):
import activatorTools
activatorTools.database(['sync'])
def dependenciesTest(options):
reagentRequestQuiet = False
+7 -1
View File
@@ -57,6 +57,7 @@ def print_help():
print_info(" \t\t"+green("md5check")+"\t\t\t\t Check digest of a package, a list of packages, world")
#print_info(" \t\t"+green(bold("orphans"))+"\t\t\t Dump the list of files that don't belong on any installed package") FIXME can be done using sets
print_info(" \t"+green(bold("deptest"))+yellow("\t\t Look for unsatisfied dependencies inside database"))
print_info(" \t"+green(bold("depends"))+yellow("\t\t Regenerate depends table (plus database lock and bump)"))
print_info(" \t\t"+red("--quiet")+"\t\t\t\t\t just print the dependencies list")
print_info(" \t"+green(bold("smartapps"))+yellow("\t Entropy application tool to create self-dependant applications [EXPERIMENTAL]"))
print_info(" \t\t"+green(bold("create"))+"\t\t\t\t\t Create a smartapp package using the package names provided")
@@ -117,11 +118,16 @@ elif (options[0] == "smartapps"):
reagentTools.smartapps(options[1:])
sys.exit(0)
# smartapps tool
# deptest tool
elif (options[0] == "deptest"):
reagentTools.dependenciesTest(options[1:])
sys.exit(0)
# deptest tool
elif (options[0] == "depends"):
reagentTools.dependsTableInitialize()
sys.exit(0)
# cleanup
if (options[0] == "cleanup"):
entropyTools.cleanup()