Drop __cargo_skip_build logic

It looks like this logic was only used for module builds, which is not
how Rust packages have been built for a few Fedora releases now.

Fixes #142.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-11-22 13:38:20 +01:00 committed by zbyszek
parent ea59cb27d1
commit 1482f79e28
2 changed files with 30 additions and 48 deletions

View file

@ -49,37 +49,31 @@ EOF\
}
%cargo_generate_buildrequires(af:) \
%if ! 0%{?__cargo_skip_build} \
%{__cargo_inspector} -BR %{__cargo_parse_opts %{-a} %{-f:-f%{-f*}}} Cargo.toml \
%if %{with check} \
%{__cargo_inspector} -BR %{__cargo_parse_opts %{-a} %{-f:-f%{-f*}}} Cargo.toml \
%if %{with check} \
%{__cargo_inspector} -TR Cargo.toml \
%endif \
%endif
%cargo_build(naf:) \
%if ! 0%{?__cargo_skip_build} \
%{shrink:\
%{shrink:\
%{__cargo} build \
%{__cargo_common_opts} \
--release \
%{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \
%* \
} \
%endif
}
%cargo_test(naf:) \
%if ! 0%{?__cargo_skip_build} \
%{shrink:\
%{shrink:\
%{__cargo} test \
%{__cargo_common_opts} \
--release \
--no-fail-fast \
%{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \
%* \
} \
%endif
}
%cargo_install(t:naf:) (\
%cargo_install(t:naf:) ( \
set -eu \
if %__cargo_is_lib; then \
CRATE_NAME=$(%__cargo_inspector --name Cargo.toml) \
@ -96,9 +90,8 @@ if %__cargo_is_lib; then \
%{__rm} -f $REG_DIR/Cargo.toml.deps \
echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \
fi \
%if ! %__cargo_skip_build \
if %__cargo_is_bin; then \
%{shrink:\
if %__cargo_is_bin; then \
%{shrink: \
%{__cargo} install \
%{__cargo_common_opts} \
--no-track \
@ -106,8 +99,7 @@ fi \
%{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \
%* \
} \
fi \
%endif \
fi \
)
%__cargo_feature_from_name(n:) %{lua:

View file

@ -6,7 +6,6 @@
%global debug_package %{nil}
{% elif not include_devel %}
{% set only_main = True %}
%global __cargo_skip_build 0
{% endif %}
%global crate {{ md.name }}
@ -43,11 +42,6 @@ Patch0: {{ patch_file }}
{% endif %}
ExclusiveArch: %{rust_arches}
{% if not only_main %}
%if %{__cargo_skip_build}
BuildArch: noarch
%endif
{% endif %}
BuildRequires: rust-packaging
{% if all_features %}
@ -62,7 +56,6 @@ BuildRequires: rust-packaging
{% 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 }}
@ -78,7 +71,6 @@ BuildRequires: {{ req }}
BuildRequires: {{ req }}
{% endfor %}
{% if has_buildrequires and not only_main %}
%endif
{% endif %}
{% endif %}
@ -94,7 +86,6 @@ BuildRequires: {{ req }}
{% if include_main %}
{% if not only_main %}
%if ! %{__cargo_skip_build}
{% endif %}
%package -n %{crate}
Summary: %{summary}
@ -118,7 +109,6 @@ Requires: {{ req }}
%{_bindir}/{{ bin.name }}
{% endfor %}
{% if not only_main %}
%endif
{% endif %}
{% endif -%}