]> err.no Git - dak/commitdiff
add options to get_suite_architectures
authorMark Hymers <mhy@debian.org>
Sat, 2 May 2009 21:16:35 +0000 (22:16 +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 42ef7e9f78eb5da11fd116ed88231fba25791fd5..3cfcac10158995060ca5b3828532ccf9c9db85d0 100755 (executable)
@@ -908,13 +908,21 @@ class SuiteArchitecture(object):
 
 __all__.append('SuiteArchitecture')
 
-def get_suite_architectures(suite, session=None):
+def get_suite_architectures(suite, skipsrc=False, skipall=False, session=None):
     """
     Returns list of Architecture objects for given C{suite} name
 
     @type source: str
     @param source: Suite name to search for
 
+    @type skipsrc: boolean
+    @param skipsrc: Whether to skip returning the 'source' architecture entry
+    (Default False)
+
+    @type skipall: boolean
+    @param skipall: Whether to skip returning the 'all' architecture entry
+    (Default False)
+
     @type session: Session
     @param session: Optional SQL session object (a temporary one will be
     generated if not supplied)
@@ -928,7 +936,12 @@ def get_suite_architectures(suite, session=None):
 
     q = session.query(Architecture)
     q = q.join(SuiteArchitecture)
-    q = q.join(Suite).filter_by(suite_name=suite).order_by('arch_string')
+    q = q.join(Suite).filter_by(suite_name=suite)
+    if skipsrc:
+        q = q.filter(Architecture.arch_string != 'source')
+    if skipall:
+        q = q.filter(Architecture.arch_string != 'all')
+    q = q.order_by('arch_string')
     return q.all()
 
 __all__.append('get_suite_architectures')