1 """ "Madison" interface
3 @contact: Debian FTPMaster <ftpmaster@debian.org>
4 @copyright: 2014 Ansgar Burchardt <ansgar@debian.org>
5 @copyright: 2014 Joerg Jaspert <joerg@debian.org>
6 @license: GNU General Public License version 2 or later
12 from daklib.ls import list_packages
13 from dakweb.webregister import QueryRegister
15 @bottle.route('/madison')
18 Display information about B{package(s)}.
22 @keyword package: Space seperated list of packages.
23 @keyword b: only show info for a binary type. I{deb/udeb/dsc}
24 @keyword c: only show info for specified component(s). I{main/contrib/non-free}
25 @keyword s: only show info for this suite.
26 @keyword S: show info for the binary children of source pkgs. I{true/false}
27 @keyword f: output json format. I{json}
28 @see: L{I{suites}<dakweb.queries.suite.suites>} on how to receive a list of valid suites.
30 @rtype: text/plain or application/json
31 @return: Text or Json format of the data
36 packages = r.query.get('package', '').split()
39 binary_type = r.query.get('b', None)
40 if binary_type is not None:
41 kwargs['binary_types'] = [binary_type]
42 component = r.query.get('c', None)
43 if component is not None:
44 kwargs['components'] = component.split(",")
45 suite = r.query.get('s', None)
47 kwargs['suites'] = suite.split(",")
49 kwargs['source_and_binary'] = True
51 # kwargs['regex'] = True
52 format = r.query.get('f', None)
53 if format is not None:
54 kwargs['format'] = 'python'
56 result = list_packages(packages, **kwargs)
59 bottle.response.content_type = 'text/plain'
64 yield json.dumps(list(result))
67 QueryRegister().register_path('/madison', madison)