[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master] add options to get_suite_architectures



Signed-off-by: Mark Hymers <mhy@debian.org>
---
 daklib/dbconn.py |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/daklib/dbconn.py b/daklib/dbconn.py
index 42ef7e9..3cfcac1 100755
--- a/daklib/dbconn.py
+++ b/daklib/dbconn.py
@@ -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')
-- 
1.5.6.5



Reply to: