From 539033b1963ac64e0d6ddc3f1a5b39a8902e04f1 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Thu, 23 Feb 2023 18:37:15 +0100 Subject: [PATCH] templates: fix stripping +build metadata from crate versions --- rust2rpm/templates/crate.spec | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rust2rpm/templates/crate.spec b/rust2rpm/templates/crate.spec index 445464a..32452c7 100644 --- a/rust2rpm/templates/crate.spec +++ b/rust2rpm/templates/crate.spec @@ -7,7 +7,7 @@ %global crate {{ crate_name }} {% if crate_version != rpm_version %} -&global crate_version {{ crate_version }} +%global crate_version {{ crate_version }} {% endif %} Name: {{ rpm_name }} @@ -30,7 +30,11 @@ License: {{ rpm_license|default("# FIXME") }} {{ rpm_license_comments }} {% endif %} URL: https://crates.io/crates/{{ crate_name }} +{% if crate_version == rpm_version %} Source: %{crates_source} +{% else %} +Source: %{crates_source %{crate} %{crate_version}} +{% endif %} {% if rpm_patch_file_automatic is not none %} # Automatically generated patch to strip foreign dependencies Patch: {{ rpm_patch_file_automatic }} @@ -168,7 +172,11 @@ use {% if feature is not none %}the "{{ feature }}" feature of {% endif %}the "% {% endif -%} %prep +{% if crate_version == rpm_version %} %autosetup -n %{crate}-%{version_no_tilde} -p1 +{% else %} +%autosetup -n %{crate}-%{crate_version} -p1 +{% endif %} %cargo_prep {% if not include_build_requires %}