| |
@@ -1,8 +1,12 @@
|
| |
{% include target ~ "-header.spec.inc" ignore missing %}
|
| |
# Generated by rust2rpm {{ generator_version }}
|
| |
%bcond_without check
|
| |
+ {% set only_main = False %}
|
| |
{% if not include_main %}
|
| |
%global debug_package %{nil}
|
| |
+ {% elif not include_devel %}
|
| |
+ {% set only_main = True %}
|
| |
+ %global __cargo_skip_build 0
|
| |
{% endif %}
|
| |
|
| |
%global crate {{ md.name }}
|
| |
@@ -39,29 +43,41 @@
|
| |
{% endif %}
|
| |
|
| |
ExclusiveArch: %{rust_arches}
|
| |
+ {% if not only_main %}
|
| |
+ %if %{__cargo_skip_build}
|
| |
+ BuildArch: noarch
|
| |
+ %endif
|
| |
+ {% endif %}
|
| |
|
| |
BuildRequires: rust-packaging
|
| |
{% if not generate_buildrequires %}
|
| |
- {% if not all_features %}
|
| |
- {% set buildrequires = normalize_deps(md.requires("default", resolve=True))|sort %}
|
| |
- {% else %}
|
| |
- {% set buildrequires = normalize_deps(md.all_dependencies)|sort %}
|
| |
- {% set cargo_args = " -a" %}
|
| |
- {% endif %}
|
| |
- {% for req in buildrequires %}
|
| |
+ {% if not all_features %}
|
| |
+ {% set buildrequires = normalize_deps(md.requires("default", resolve=True))|sort %}
|
| |
+ {% else %}
|
| |
+ {% set buildrequires = normalize_deps(md.all_dependencies)|sort %}
|
| |
+ {% set cargo_args = " -a" %}
|
| |
+ {% endif %}
|
| |
+ {% set testrequires = normalize_deps(md.dev_dependencies)|sort %}
|
| |
+ {% set has_buildrequires = (buildrequires + testrequires)|length > 0 %}
|
| |
+ {% if has_buildrequires and not only_main %}
|
| |
+ %if ! %{__cargo_skip_build}
|
| |
+ {% endif %}
|
| |
+ {% for req in buildrequires %}
|
| |
BuildRequires: {{ req }}
|
| |
- {% endfor %}
|
| |
- {% set testrequires = normalize_deps(md.dev_dependencies)|sort %}
|
| |
- {% if testrequires|length > 0 %}
|
| |
+ {% endfor %}
|
| |
+ {% if testrequires|length > 0 %}
|
| |
%if %{with check}
|
| |
- {% for req in testrequires %}
|
| |
+ {% for req in testrequires %}
|
| |
BuildRequires: {{ req }}
|
| |
- {% endfor %}
|
| |
+ {% endfor %}
|
| |
%endif
|
| |
- {% endif %}
|
| |
- {% for req in to_list(distconf.get("buildrequires"))|sort %}
|
| |
+ {% endif %}
|
| |
+ {% for req in to_list(distconf.get("buildrequires"))|sort %}
|
| |
BuildRequires: {{ req }}
|
| |
- {% endfor %}
|
| |
+ {% endfor %}
|
| |
+ {% if has_buildrequires and not only_main %}
|
| |
+ %endif
|
| |
+ {% endif %}
|
| |
{% endif %}
|
| |
|
| |
%global _description %{expand:
|
| |
@@ -75,6 +91,9 @@
|
| |
%description %{_description}
|
| |
|
| |
{% if include_main %}
|
| |
+ {% if not only_main %}
|
| |
+ %if ! %{__cargo_skip_build}
|
| |
+ {% endif %}
|
| |
%package -n %{crate}
|
| |
Summary: %{summary}
|
| |
{% if rust_group is defined %}
|
| |
@@ -96,6 +115,9 @@
|
| |
{% for bin in bins %}
|
| |
%{_bindir}/{{ bin.name }}
|
| |
{% endfor %}
|
| |
+ {% if not only_main %}
|
| |
+ %endif
|
| |
+ {% endif %}
|
| |
|
| |
{% endif -%}
|
| |
|
| |
With this, we should be able to build modules with Rust apps within 10 minutes or so.