提交 a4a019fa 编写于 作者: M Mike O'Connor

use get_suite_architectures from dbconn.py instead of database.py

Signed-off-by: NMike O'Connor <stew@vireo.org>
上级 f3db7ee8
......@@ -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
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册