From 505a0bb4514f679506f49f9af5bc26a84844f873 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Nov 16 2015 08:49:31 +0000 Subject: Include the dependencies information in the json blob returned for a package --- diff --git a/mdapi/__init__.py b/mdapi/__init__.py index 4778127..5c45c45 100644 --- a/mdapi/__init__.py +++ b/mdapi/__init__.py @@ -105,6 +105,27 @@ def get_pkg(request): with file_lock.FileFlock(dbfile + '.lock'): session = mdapilib.create_session('sqlite:///%s' % dbfile) + # Fill in some extra info + + # Basic infos, always present regardless of the version of the repo + for datatype in ['conflicts', 'obsoletes', 'provides', 'requires']: + data = mdapilib.get_package_info( + session, pkg.pkgKey, datatype.capitalize()) + if data: + output[datatype] = [item.to_json() for item in data] + else: + output[datatype] = data + + # New meta-data present for soft dependency management in RPM + for datatype in ['enhances', 'recommends', 'suggests', 'supplements']: + data = mdapilib.get_package_info( + session, pkg.pkgKey, datatype.capitalize()) + if data: + output[datatype] = [item.to_json() for item in data] + else: + output[datatype] = data + + # Add the list of packages built from the same src.rpm if pkg.rpm_sourcerpm: output['co-packages'] = list(set([ cpkg.name