+
+def get_suites(pkgname, src=False):
+ """ Return the suites in which pkgname is. If src is True, query for source package, else binary. """
+ if src:
+ sql = """
+ SELECT suite_name
+ FROM source,
+ src_associations,
+ suite
+ WHERE source.id = src_associations.source
+ AND source.source = '%s'
+ AND src_associations.suite = suite.id
+ """ % (pkgname)
+ else:
+ sql = """
+ SELECT suite_name
+ FROM binaries,
+ bin_associations,
+ suite
+ WHERE binaries.id = bin_associations.bin
+ AND package = '%s'
+ AND bin_associations.suite = suite.id
+ """ % (pkgname)
+
+ q = projectB.query(sql)
+ return map(lambda x: x[0], q.getresult())