templates: fix stripping +build metadata from crate versions

This commit is contained in:
Fabio Valentini 2023-02-23 18:37:15 +01:00
parent 15facc465b
commit 539033b196
No known key found for this signature in database
GPG key ID: 5AC5F572E5D410AF

View file

@ -7,7 +7,7 @@
%global crate {{ crate_name }} %global crate {{ crate_name }}
{% if crate_version != rpm_version %} {% if crate_version != rpm_version %}
&global crate_version {{ crate_version }} %global crate_version {{ crate_version }}
{% endif %} {% endif %}
Name: {{ rpm_name }} Name: {{ rpm_name }}
@ -30,7 +30,11 @@ License: {{ rpm_license|default("# FIXME") }}
{{ rpm_license_comments }} {{ rpm_license_comments }}
{% endif %} {% endif %}
URL: https://crates.io/crates/{{ crate_name }} URL: https://crates.io/crates/{{ crate_name }}
{% if crate_version == rpm_version %}
Source: %{crates_source} Source: %{crates_source}
{% else %}
Source: %{crates_source %{crate} %{crate_version}}
{% endif %}
{% if rpm_patch_file_automatic is not none %} {% if rpm_patch_file_automatic is not none %}
# Automatically generated patch to strip foreign dependencies # Automatically generated patch to strip foreign dependencies
Patch: {{ rpm_patch_file_automatic }} Patch: {{ rpm_patch_file_automatic }}
@ -168,7 +172,11 @@ use {% if feature is not none %}the "{{ feature }}" feature of {% endif %}the "%
{% endif -%} {% endif -%}
%prep %prep
{% if crate_version == rpm_version %}
%autosetup -n %{crate}-%{version_no_tilde} -p1 %autosetup -n %{crate}-%{version_no_tilde} -p1
{% else %}
%autosetup -n %{crate}-%{crate_version} -p1
{% endif %}
%cargo_prep %cargo_prep
{% if not include_build_requires %} {% if not include_build_requires %}