]> git.decadent.org.uk Git - dak.git/commitdiff
add get_binary_components (from p-u)
authorMark Hymers <mhy@debian.org>
Sat, 23 May 2009 21:34:32 +0000 (22:34 +0100)
committerMark Hymers <mhy@debian.org>
Sun, 9 Aug 2009 15:49:21 +0000 (16:49 +0100)
Signed-off-by: Mark Hymers <mhy@debian.org>
daklib/dbconn.py

index 3cfcac10158995060ca5b3828532ccf9c9db85d0..cf9ca9a54c7df7d12a007c36161ff86dbfefdaa6 100755 (executable)
@@ -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):