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 a: only show info for specified architectures.
24 @keyword b: only show info for a binary type. I{deb/udeb/dsc}
25 @keyword c: only show info for specified component(s). I{main/contrib/non-free}
26 @keyword s: only show info for this suite.
27 @keyword S: show info for the binary children of source pkgs. I{true/false}
28 @keyword f: output json format. I{json}
29 @see: L{I{suites}<dakweb.queries.suite.suites>} on how to receive a list of valid suites.
31 @rtype: text/plain or application/json
32 @return: Text or Json format of the data
37 packages = r.query.get('package', '').split()
40 architectures = r.query.get('a', None)
41 if architectures is not None:
42 kwargs['architectures'] = architectures.split(",")
43 binary_type = r.query.get('b', None)
44 if binary_type is not None:
45 kwargs['binary_types'] = [binary_type]
46 component = r.query.get('c', None)
47 if component is not None:
48 kwargs['components'] = component.split(",")
49 suite = r.query.get('s', None)
51 kwargs['suites'] = suite.split(",")
53 kwargs['source_and_binary'] = True
55 # kwargs['regex'] = True
56 format = r.query.get('f', None)
57 if format is not None:
58 kwargs['format'] = 'python'
60 result = list_packages(packages, **kwargs)
63 bottle.response.content_type = 'text/plain'
68 yield json.dumps(list(result))
71 QueryRegister().register_path('/madison', madison)