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]})
35 return json.dumps(ret)
37 QueryRegister().register_path('/suites', suites)
39 @bottle.route('/suite/<suite>')
40 def suite(suite=None):
46 Gives information about a single suite. Note that this routine will look
47 up a suite first by the main suite_name, but then also by codename if no
48 suite is initially found. It can therefore be used to canonicalise suite
53 return bottle.HTTPError(503, 'Suite not specified.')
55 # TODO: We should probably stick this logic into daklib/dbconn.py
58 s = DBConn().session()
60 q = q.filter(Suite.suite_name == suite)
63 # This would mean dak is misconfigured
64 return bottle.HTTPError(503, 'Multiple suites found: configuration error')
68 # Look it up by suite_name
69 q = s.query(Suite).filter(Suite.codename == suite)
71 # This would mean dak is misconfigured
72 return bottle.HTTPError(503, 'Multiple suites found: configuration error')
77 so = {'name': so.release_suite_output,
78 'codename': so.codename,
79 'dakname': so.suite_name,
80 'archive': so.archive.archive_name,
81 'architectures': [x.arch_string for x in so.architectures],
82 'components': [x.component_name for x in so.components]}
86 QueryRegister().register_path('/suite', suite)