From 1482f79e28894b8815fd2d2a831258883eee3764 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Nov 25 2021 08:49:17 +0000 Subject: 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. --- diff --git a/data/macros.cargo b/data/macros.cargo index 10c1163..0a68998 100644 --- a/data/macros.cargo +++ b/data/macros.cargo @@ -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} -TR Cargo.toml \ - %endif \ +%{__cargo_inspector} -BR %{__cargo_parse_opts %{-a} %{-f:-f%{-f*}}} Cargo.toml \ +%if %{with check} \ + %{__cargo_inspector} -TR Cargo.toml \ %endif %cargo_build(naf:) \ -%if ! 0%{?__cargo_skip_build} \ - %{shrink:\ - %{__cargo} build \ - %{__cargo_common_opts} \ - --release \ - %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ - %* \ - } \ -%endif +%{shrink:\ + %{__cargo} build \ + %{__cargo_common_opts} \ + --release \ + %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ + %* \ +} %cargo_test(naf:) \ -%if ! 0%{?__cargo_skip_build} \ - %{shrink:\ - %{__cargo} test \ - %{__cargo_common_opts} \ - --release \ - --no-fail-fast \ - %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ - %* \ - } \ -%endif +%{shrink:\ + %{__cargo} test \ + %{__cargo_common_opts} \ + --release \ + --no-fail-fast \ + %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ + %* \ +} -%cargo_install(t:naf:) (\ +%cargo_install(t:naf:) ( \ set -eu \ if %__cargo_is_lib; then \ CRATE_NAME=$(%__cargo_inspector --name Cargo.toml) \ @@ -95,19 +89,17 @@ if %__cargo_is_lib; then \ %{__cp} -a Cargo.toml $REG_DIR/Cargo.toml \ %{__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:\ - %{__cargo} install \ - %{__cargo_common_opts} \ - --no-track \ - --path . \ - %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ - %* \ - } \ - fi \ -%endif \ +fi \ +if %__cargo_is_bin; then \ + %{shrink: \ + %{__cargo} install \ + %{__cargo_common_opts} \ + --no-track \ + --path . \ + %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \ + %* \ + } \ +fi \ ) %__cargo_feature_from_name(n:) %{lua: diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec index c61ce91..567b400 100644 --- a/rust2rpm/templates/main.spec +++ b/rust2rpm/templates/main.spec @@ -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 -%}