From: Mike O'Connor Date: Sun, 22 Feb 2009 17:08:00 +0000 (-0500) Subject: use get_suite_architectures from dbconn.py instead of database.py X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4a019fa541fec6ad205f5e36e5f2a2cdf797235;p=dak use get_suite_architectures from dbconn.py instead of database.py Signed-off-by: Mike O'Connor --- diff --git a/dak/process_unchecked.py b/dak/process_unchecked.py index aa2926a0..491c5560 100755 --- a/dak/process_unchecked.py +++ b/dak/process_unchecked.py @@ -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 diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 6070cded..21c9cc62 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -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