]> git.decadent.org.uk Git - dak.git/commitdiff
add methods for easily finding suites for src/bin packages
authorMark Hymers <mhy@debian.org>
Fri, 24 Jul 2009 21:01:21 +0000 (22:01 +0100)
committerMark Hymers <mhy@debian.org>
Sun, 9 Aug 2009 15:49:27 +0000 (16:49 +0100)
Signed-off-by: Mark Hymers <mhy@debian.org>
daklib/dbconn.py

index 66921b851a8efef6d5f530561d5376bc0400ac09..7d460760b9102c82a97341b3faac34a423e9c57d 100755 (executable)
@@ -171,6 +171,24 @@ class DBBinary(object):
 
 __all__.append('DBBinary')
 
+def get_suites_binary_in(package, session=None):
+    """
+    Returns list of Suite objects which given C{package} name is in
+
+    @type source: str
+    @param source: DBBinary package name to search for
+
+    @rtype: list
+    @return: list of Suite objects for the given package
+    """
+
+    if session is None:
+        session = DBConn().session()
+
+    return session.query(Suite).join(BinAssociation).join(DBBinary).filter_by(package=package).all()
+
+__all__.append('get_suites_binary_in')
+
 def get_binary_from_id(id, session=None):
     """
     Returns DBBinary object for given C{id}
@@ -1288,6 +1306,24 @@ def source_exists(source, source_version, suites = ["any"], session=None):
 
 __all__.append('source_exists')
 
+def get_suites_source_in(source, session=None):
+    """
+    Returns list of Suite objects which given C{source} name is in
+
+    @type source: str
+    @param source: DBSource package name to search for
+
+    @rtype: list
+    @return: list of Suite objects for the given source
+    """
+
+    if session is None:
+        session = DBConn().session()
+
+    return session.query(Suite).join(SrcAssociation).join(DBSource).filter_by(source=source).all()
+
+__all__.append('get_suites_source_in')
+
 def get_sources_from_name(source, version=None, dm_upload_allowed=None, session=None):
     """
     Returns list of DBSource objects for given C{source} name and other parameters