From 8a202fbe5525f0e89d895bed3f1603bad4b85b9b Mon Sep 17 00:00:00 2001 From: lxnay Date: Sat, 31 Mar 2007 10:21:50 +0000 Subject: [PATCH] some more fixes git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@247 cd1c1023-2f26-0410-ae45-c471fc1f0318 --- TODO | 8 ++++--- handlers/reagent | 1 + libraries/databaseTools.py | 44 ++++++++++++++++++++++++++++++++++++++ libraries/entropyTools.py | 1 - 4 files changed, 50 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index a7fff7a1a..28d635e91 100644 --- a/TODO +++ b/TODO @@ -1,11 +1,13 @@ TODO list (for developers only): - build() and world(), on enzyme, add the support for whitelist+cron - build(), on enzyme, add license blacklist (packages that cannot be shipped in a binary form) -- activator: add support for stable/unstable branch +- entropy: add support for stable/unstable branch +- reagent: complete the database stabilize function +- reagent: add the option to delete a package in the database - activator tasks: + - COMPLETE sync ! - add/remove packages from the database - - tidy tool: cleanup policy to prune old binaries - - database update and management between me and reagent + - tidy tool will be a joint work between reagent and activator libraries: cleanup policy to prune old binaries - Sabayon Linux USE flags: remove all server related use flags diff --git a/handlers/reagent b/handlers/reagent index 5ddb6ffb0..300de86a3 100644 --- a/handlers/reagent +++ b/handlers/reagent @@ -52,6 +52,7 @@ def print_help(): entropyTools.print_info(" \t\t"+entropyTools.green("inject-package-info")+"\t Inject an Entropy dump inside the database (file path is mandatory)") entropyTools.print_info(" \t\t"+entropyTools.green("restore-package-info")+"\t Reinitialize a package entry looking at the current install") entropyTools.print_info(" \t\t"+entropyTools.green("create-empty-database")+"\t Create an empty Entropy database file in the specified ") + entropyTools.print_info(" \t\t"+entropyTools.green("stabilize")+"\t\t Mark as stable a package, a list of packages, world") entropyTools.print_info(" \t"+entropyTools.green(entropyTools.bold("cleanup"))+entropyTools.yellow("\t\t to clean temporary files")) options = sys.argv[1:] diff --git a/libraries/databaseTools.py b/libraries/databaseTools.py index 4a48075d0..f1608cdf6 100644 --- a/libraries/databaseTools.py +++ b/libraries/databaseTools.py @@ -274,6 +274,27 @@ def database(options): connection.close() entropyTools.print_info(entropyTools.green(" * ")+entropyTools.red("Entropy database file ")+entropyTools.bold(mypath[0])+entropyTools.red(" successfully initialized.")) + elif (options[0] == "stabilize"): + myatoms = options[1:] + if len(myatoms) == 0: + entropyTools.print_error(entropyTools.yellow(" * ")+entropyTools.red("Not enough parameters")) + sys.exit(303) + # is world? + if myatoms[0] == "world": + # open db in read only + dbconn = etpDatabase(readOnly = True) + worldPackages = dbconn.listAllPackages() + # This is the list of all the packages available in Entropy + print worldPackages + dbconn.closeDB() + + # filter dups + myatoms = list(set(myatoms)) + + print "DEBUG: Proposed atoms: "+str(myatoms) + + + ############ # Functions and Classes ##################################################################################### @@ -468,6 +489,9 @@ class etpDatabase: return update, revision def addPackage(self,etpData, revision = 0): + print + print etpData['content'] + print self.cursor.execute( 'INSERT into etpData VALUES ' '(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)' @@ -588,6 +612,26 @@ class etpDatabase: result.append(row) return result + def listAllPackages(self): + result = [] + self.cursor.execute('SELECT * FROM etpData') + for row in self.cursor: + result.append(row[0]) + return result + + def listStablePackages(self): + result = [] + self.cursor.execute('SELECT * FROM etpData WHERE branch = "stable"') + for row in self.cursor: + result.append(row[0]) + return result + + def listUnstablePackages(self): + result = [] + self.cursor.execute('SELECT * FROM etpData WHERE branch = "unstable"') + for row in self.cursor: + result.append(row[0]) + return result # ------ BEGIN: activator tools ------ diff --git a/libraries/entropyTools.py b/libraries/entropyTools.py index 2a6154d27..e08353d0c 100644 --- a/libraries/entropyTools.py +++ b/libraries/entropyTools.py @@ -147,7 +147,6 @@ def getEtpRemoteDatabaseStatus(): else: revision = 0 else: - print "database file not avail" # then set mtime to 0 and quit revision = 0 info = [uri+"/"+etpConst['etpurirelativepath']+etpConst['etpdatabasefilegzip'],revision]