6 from daklib.dbconn import DBConn, Suite
7 from dakweb.webregister import QueryRegister
9 @bottle.route('/suites')
14 returns: list of dictionaries
16 Give information about all known suites.
18 name maps to Suite: in the release file
19 codename maps to Codename: in the release file.
20 dakname is an internal name and should not be relied upon.
23 s = DBConn().session()
25 q = q.order_by(Suite.suite_name)
28 ret.append({'name': p.release_suite_output,
29 'codename': p.codename,
30 'dakname': p.suite_name,
31 'archive': p.archive.archive_name,
32 'architectures': [x.arch_string for x in p.architectures],
33 'components': [x.component_name for x in p.components]})
37 return json.dumps(ret)
39 QueryRegister().register_path('/suites', suites)
41 @bottle.route('/suite/<suite>')
42 def suite(suite=None):
48 Gives information about a single suite. Note that this routine will look
49 up a suite first by the main suite_name, but then also by codename if no
50 suite is initially found. It can therefore be used to canonicalise suite
55 return bottle.HTTPError(503, 'Suite not specified.')
57 # TODO: We should probably stick this logic into daklib/dbconn.py
60 s = DBConn().session()
62 q = q.filter(Suite.suite_name == suite)
65 # This would mean dak is misconfigured
67 return bottle.HTTPError(503, 'Multiple suites found: configuration error')
71 # Look it up by suite_name
72 q = s.query(Suite).filter(Suite.codename == suite)
74 # This would mean dak is misconfigured
76 return bottle.HTTPError(503, 'Multiple suites found: configuration error')
81 so = {'name': so.release_suite_output,
82 'codename': so.codename,
83 'dakname': so.suite_name,
84 'archive': so.archive.archive_name,
85 'architectures': [x.arch_string for x in so.architectures],
86 'components': [x.component_name for x in so.components]}
92 QueryRegister().register_path('/suite', suite)