]> git.decadent.org.uk Git - dak.git/commitdiff
Merge commit 'buxy/bugfixes' into merge
authorJoerg Jaspert <joerg@debian.org>
Sat, 25 Apr 2009 22:39:22 +0000 (00:39 +0200)
committerJoerg Jaspert <joerg@debian.org>
Sat, 25 Apr 2009 22:39:22 +0000 (00:39 +0200)
* commit 'buxy/bugfixes':
  dak update-db: fixes to make it work on a fresh install
  dak init-db: properly initialize suite_architectures

Signed-off-by: Joerg Jaspert <joerg@debian.org>
dak/dakdb/update3.py
dak/dakdb/update5.py
dak/init_db.py
docs/README.first

index c91ecf56eadba987c11339109ea371a71cfa65a4..406cc89b3212a59ead022c4037f29663f2f46932 100755 (executable)
@@ -36,7 +36,12 @@ def do_update(self):
 
     try:
         c = self.db.cursor()
-        c.execute("DROP FUNCTION versioncmp(text, text);")
+        try:
+            # This might not exist on a fresh install, so don't fail
+            # needlessly
+            c.execute("DROP FUNCTION versioncmp(text, text);")
+        except:
+            pass
         c.execute("UPDATE config SET value = '3' WHERE name = 'db_revision'")
 
         self.db.commit()
index beb961cc3c58d669f0a17f0723e94f758f9897db..49e338916b92f1a0b4ba9d16912d0059829bde12 100755 (executable)
@@ -36,7 +36,6 @@ def do_update(self):
     print "Fixing bin_assoc_by_arch view"
     try:
         c = self.db.cursor()
-        c.execute("DROP VIEW bin_assoc_by_arch")
 
         c.execute("""CREATE OR REPLACE VIEW bin_assoc_by_arch AS
         SELECT ba.suite, ba.bin, a.id AS arch
index 31a2a5a7b9d022db2f660a4564e0c21496720ee9..e15d7680799ab0dc0d69e24ebf5743cc249f3ba4 100755 (executable)
@@ -139,7 +139,7 @@ class InitDB(object):
             origin = sql_get(suite_config, "Origin")
             description = sql_get(suite_config, "Description")
             c.execute(suite_add, [suite.lower(), version, origin, description])
-            for architecture in self.Cnf.ValueList("Suite::%s::Architectures" % (suite)):
+            for architecture in self.Cnf.SubTree("Architectures").List():
                 architecture_id = self.projectB.get_architecture_id (architecture)
                 if architecture_id < 0:
                     utils.fubar("architecture '%s' not found in architecture"
index 9b7aa9cb221ce5d7ffe200199db6545a13068da5..237d63cf6b54f0929a5c86bacab1556a31591c8e 100644 (file)
@@ -114,6 +114,7 @@ o If you have an existing archive:
      which are needed for this.  After changing all occurences of "projectb"
      to the name of your database (as defined in DB::Name) you can run:
          psql <DB::Name> < init_pool.sql
+   * Run 'dak update-db' to upgrade the database schema.
    * Run 'dak init-db': it will populate your database with the values from
      dak.conf and apt.conf.
    * Run 'psql <DB::Name> < add_constraints.sql'.