try to automatically generate license out of metadata

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
Igor Gnatenko 2017-02-05 12:07:49 +01:00
parent 38ca0bf280
commit d2aad3723f
2 changed files with 8 additions and 2 deletions

View file

@ -32,6 +32,8 @@ class Dependency(object):
class Metadata(object):
def __init__(self):
self.name = None
self.license = None
self.license_file = None
self._version = None
self._provides = []
self._requires = []
@ -47,6 +49,8 @@ class Metadata(object):
md = metadata["packages"][0]
self.name = md["name"]
self.license = md["license"]
self.license_file = md["license_file"]
self._version = semver.SpecItem("={}".format(md["version"]))
# Provides

View file

@ -21,7 +21,7 @@ Version: {{ md.version }}
Release: 1%{?dist}
Summary: # FIXME
License: # FIXME
License: {{ md.license if md.license is not none else "# FIXME" }}
URL: https://crates.io/crates/{{ md.name }}
Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate
@ -80,7 +80,9 @@ Conflicts: {{ con }}
%endif
%files devel
%license # FIXME
{% if md.license_file is not none %}
%license {{ md.license_file }}
{% endif %}
%{cargo_registry}/%{crate}-%{version}/
%changelog