]> git.decadent.org.uk Git - dak.git/commitdiff
use get_suite_architectures from dbconn.py instead of database.py
authorMike O'Connor <stew@vireo.org>
Sun, 22 Feb 2009 17:08:00 +0000 (12:08 -0500)
committerMike O'Connor <stew@vireo.org>
Sun, 22 Feb 2009 17:08:00 +0000 (12:08 -0500)
Signed-off-by: Mike O'Connor <stew@vireo.org>
dak/process_unchecked.py
daklib/dbconn.py

index aa2926a0c85be6a8f181e738ec57964589d9cc71..491c5560ec7b7c968b17bbeeb37c4514f778c049 100755 (executable)
@@ -326,7 +326,7 @@ def check_distributions():
             (source, dest) = args[1:3]
             if changes["distribution"].has_key(source):
                 for arch in changes["architecture"].keys():
-                    if arch not in database.get_suite_architectures(source):
+                    if arch not in DBConn().get_suite_architectures(source):
                         reject("Mapping %s to %s for unreleased architecture %s." % (source, dest, arch),"")
                         del changes["distribution"][source]
                         changes["distribution"][dest] = 1
@@ -474,7 +474,7 @@ def check_files():
             default_suite = Cnf.get("Dinstall::DefaultSuite", "Unstable")
             architecture = control.Find("Architecture")
             upload_suite = changes["distribution"].keys()[0]
-            if architecture not in database.get_suite_architectures(default_suite) and architecture not in database.get_suite_architectures(upload_suite):
+            if architecture not in DBConn().get_suite_architectures(default_suite) and architecture not in DBConn().get_suite_architectures(upload_suite):
                 reject("Unknown architecture '%s'." % (architecture))
 
             # Ensure the architecture of the .deb is one of the ones
index 6070cded680d560e9cfc4ccca366993eea30c8a7..21c9cc626a82956b8e75fb207073cf0abb692e09 100755 (executable)
@@ -452,6 +452,32 @@ class DBConn(Singleton):
 
         return id
 
+    def get_suite_architectures(self, suite):
+        """
+        Returns list of architectures for C{suite}.
+
+        @type suite: string, int
+        @param suite: the suite name or the suite_id
+
+        @rtype: list
+        @return: the list of architectures for I{suite}
+        """
+
+        suite_id = None
+        if type(suite) == str:
+            suite_id = self.get_suite_id(suite)
+        elif type(suite) == int:
+            suite_id = suite
+        else:
+            return None
+
+        c = self.db_con.cursor()
+        c.execute( """SELECT a.arch_string FROM suite_architectures sa
+                      JOIN architecture a ON (a.id = sa.architecture)
+                      WHERE suite='%s'""" % suite_id )
+
+        return map(lambda x: x[0], c.fetchall())
+
     def insert_content_paths(self, package, fullpaths):
         """
         Make sure given path is associated with given binary id