From: Mark Hymers Date: Sat, 2 May 2009 21:16:35 +0000 (+0100) Subject: add options to get_suite_architectures X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=5387de41f22566e9ca42fe933e0dc4893226bfea;p=dak.git add options to get_suite_architectures Signed-off-by: Mark Hymers --- diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 42ef7e9f..3cfcac10 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')