4 from daklib.ls import list_packages
5 from dakweb.webregister import QueryRegister
7 @bottle.route('/madison')
10 Display information about packages.
12 b=TYPE only show info for binary TYPE
13 c=COMPONENT only show info for COMPONENT(s)
14 s=SUITE only show info for this suite
15 S=true show info for the binary children of source pkgs
16 f=json output json format
21 packages = r.query.get('package', '').split()
24 binary_type = r.query.get('b', None)
25 if binary_type is not None:
26 kwargs['binary_types'] = [binary_type]
27 component = r.query.get('c', None)
28 if component is not None:
29 kwargs['components'] = component.split(",")
30 suite = r.query.get('s', None)
32 kwargs['suites'] = suite.split(",")
34 kwargs['source_and_binary'] = True
36 # kwargs['regex'] = True
37 format = r.query.get('f', None)
38 if format is not None:
39 kwargs['format'] = 'python'
41 result = list_packages(packages, **kwargs)
44 bottle.response.content_type = 'text/plain'
49 yield json.dumps(list(result))
52 QueryRegister().register_path('/madison', madison)