From 561280a0ea35f226ef243526be2bbb656db44af6 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 10 Sep 2018 23:40:18 +0200 Subject: [PATCH] generate %doc statements Signed-off-by: Igor Gnatenko --- rust2rpm/metadata.py | 2 ++ rust2rpm/templates/main.spec | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py index 5dae1d3..f52d968 100644 --- a/rust2rpm/metadata.py +++ b/rust2rpm/metadata.py @@ -140,6 +140,7 @@ class Metadata(object): self.name = None self.license = None self.license_file = None + self.readme = None self.description = None self.version = None self._targets = [] @@ -156,6 +157,7 @@ class Metadata(object): self.name = md["name"] self.license = md["license"] self.license_file = md["license_file"] + self.readme = md["readme"] self.description = md.get("description") self.version = md["version"] version = "={}".format(self.version) diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec index 1aeb969..2e9f841 100644 --- a/rust2rpm/templates/main.spec +++ b/rust2rpm/templates/main.spec @@ -137,6 +137,9 @@ which use %{crate} from crates.io. {% if md.license_file is not none %} %license {{ md.license_file }} {% endif %} +{% if md.readme is not none %} +%doc {{ md.readme }} +{% endif %} {% for bin in bins %} %{_bindir}/{{ bin.name }} {% endfor %} @@ -147,6 +150,9 @@ which use %{crate} from crates.io. {% if md.license_file is not none %} %license {{ md.license_file }} {% endif %} +{% if md.readme is not none %} +%doc {{ md.readme }} +{% endif %} %{cargo_registry}/%{crate}-%{version}/ {% endif %}