From: Mark Hymers Date: Sat, 23 May 2009 21:34:32 +0000 (+0100) Subject: add get_binary_components (from p-u) X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b43f0a27191bcf2d20e4fa24ad2be8723ccbf518;p=dak add get_binary_components (from p-u) Signed-off-by: Mark Hymers --- diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 3cfcac10..cf9ca9a5 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -210,6 +210,23 @@ def get_binaries_from_name(package, session=None): __all__.append('get_binaries_from_name') +def get_binary_components(package, suitename, arch, session=None): +# Check for packages that have moved from one component to another + query = """SELECT c.name FROM binaries b, bin_associations ba, suite s, location l, component c, architecture a, files f + WHERE b.package=:package AND s.suite_name=:suitename + AND (a.arch_string = :arch OR a.arch_string = 'all') + AND ba.bin = b.id AND ba.suite = s.id AND b.architecture = a.id + AND f.location = l.id + AND l.component = c.id + AND b.file = f.id""" + + vals = {'package': package, 'suitename': suitename, 'arch': arch} + + if session is None: + session = DBConn().session() + return session.execute(query, vals) + +__all__.append('get_binary_components') ################################################################################ class Component(object):