From: Ansgar Burchardt Date: Tue, 7 May 2013 20:07:01 +0000 (+0200) Subject: Merge remote-tracking branch 'origin/master' X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=b3f49124b42e8798f9abb47a94d4cf85bc9671bf;hp=c5fdfd52d7440715b01ebc5e5b7309205a68db8e;p=dak.git Merge remote-tracking branch 'origin/master' --- diff --git a/dak/generate_releases.py b/dak/generate_releases.py index a849f36d..6a1bf84e 100755 --- a/dak/generate_releases.py +++ b/dak/generate_releases.py @@ -178,7 +178,7 @@ class ReleaseWriter(object): components = [ c.component_name for c in session.query(Component) ] - out.write("Components: %s\n" % ( " ".join(map(lambda x: "%s%s" % (suite_suffix, x), components )))) + out.write("Components: %s\n" % (" ".join(components))) # For exact compatibility with old g-r, write out Description here instead # of with the rest of the DB fields above diff --git a/dak/process_new.py b/dak/process_new.py index 92104435..f33b53ba 100755 --- a/dak/process_new.py +++ b/dak/process_new.py @@ -126,6 +126,7 @@ def takenover_binaries(upload, missing, session): if m['type'] != 'dsc': binaries.remove(m['package']) if binaries: + source = upload.binaries[0].source.source suite = upload.target_suite.overridesuite or \ upload.target_suite.suite_name suites = [s[0] for s in session.query(Suite.suite_name).filter \ @@ -134,7 +135,7 @@ def takenover_binaries(upload, missing, session): rows = session.query(DBSource.source, DBBinary.package).distinct(). \ filter(DBBinary.package.in_(binaries)). \ join(DBBinary.source). \ - filter(DBSource.source != upload.source.source). \ + filter(DBSource.source != source). \ join(DBBinary.suites). \ filter(Suite.suite_name.in_(suites)). \ order_by(DBSource.source, DBBinary.package).all() diff --git a/dak/update_db.py b/dak/update_db.py index 4ac0c5db..5bbc40c5 100755 --- a/dak/update_db.py +++ b/dak/update_db.py @@ -37,6 +37,8 @@ import os import apt_pkg import time import errno +from glob import glob +from re import findall from daklib import utils from daklib.config import Config @@ -46,7 +48,6 @@ from daklib.daklog import Logger ################################################################################ Cnf = None -required_database_schema = 97 ################################################################################ @@ -120,6 +121,7 @@ Updates dak's database schema to the lastest version. You should disable crontab print "Determining dak database revision ..." cnf = Config() logger = Logger('update-db') + modules = [] try: # Build a connect string @@ -155,25 +157,39 @@ Updates dak's database schema to the lastest version. You should disable crontab self.update_db_to_zero() database_revision = 0 + dbfiles = glob(os.path.join(os.path.dirname(__file__), 'dakdb/update*.py')) + required_database_schema = int(max(findall('update(\d+).py', " ".join(dbfiles)))) + print "dak database schema at %d" % database_revision print "dak version requires schema %d" % required_database_schema - if database_revision == required_database_schema: + if database_revision < required_database_schema: + print "\nUpdates to be applied:" + for i in range(database_revision, required_database_schema): + i += 1 + dakdb = __import__("dakdb", globals(), locals(), ['update'+str(i)]) + update_module = getattr(dakdb, "update"+str(i)) + print "Update %d: %s" % (i, next(s for s in update_module.__doc__.split("\n") if s)) + modules.append((update_module, i)) + prompt = "\nUpdate database? (y/N) " + answer = utils.our_raw_input(prompt) + if answer.upper() != 'Y': + sys.exit(0) + else: print "no updates required" logger.log(["no updates required"]) sys.exit(0) - for i in range (database_revision, required_database_schema): + for module in modules: + (update_module, i) = module try: - dakdb = __import__("dakdb", globals(), locals(), ['update'+str(i+1)]) - update_module = getattr(dakdb, "update"+str(i+1)) update_module.do_update(self) - message = "updated database schema from %d to %d" % (database_revision, i+1) + message = "updated database schema from %d to %d" % (database_revision, i) print message logger.log([message]) except DBUpdateError as e: # Seems the update did not work. - print "Was unable to update database schema from %d to %d." % (database_revision, i+1) + print "Was unable to update database schema from %d to %d." % (database_revision, i) print "The error message received was %s" % (e) logger.log(["DB Schema upgrade failed"]) logger.close() diff --git a/scripts/debian/rrd-release-freeze-dates b/scripts/debian/rrd-release-freeze-dates index 457e2336..4d1c4363 100644 --- a/scripts/debian/rrd-release-freeze-dates +++ b/scripts/debian/rrd-release-freeze-dates @@ -1,4 +1,3 @@ -VRULE:1234691928#632a5b:lenny release -VRULE:1281102258#0b19c1:squeeze freeze VRULE:1296908977#0b19c1:squeeze release VRULE:1341078720#00ff00:wheezy freeze +VRULE:1367689920#00ff00:wheezy release