#157 Drop __cargo_skip_build logic
Merged 2 years ago by zbyszek. Opened 2 years ago by zbyszek.
fedora-rust/ zbyszek/rust2rpm drop-skip-build-logic  into  main

file modified
+30 -38
@@ -49,37 +49,31 @@ 

  }

  

  %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 @@ 

    %{__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:

@@ -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 @@ 

  {% 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 @@ 

    {% 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 }}

    {% endfor %}

    {% if has_buildrequires and not only_main %}

- %endif

    {% endif %}

  {% endif %}

  
@@ -94,7 +86,6 @@ 

  

  {% if include_main %}

    {% if not only_main %}

- %if ! %{__cargo_skip_build}

    {% endif %}

  %package     -n %{crate}

  Summary:        %{summary}
@@ -118,7 +109,6 @@ 

  %{_bindir}/{{ bin.name }}

    {% endfor %}

    {% if not only_main %}

- %endif

    {% endif %}

  

  {% endif -%}

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.

Looks like I would have done. So :thumbsup: , thanks for working on it (I sadly don't have that much time for programming tasks outside of packaging right now ...)

rebased onto 1482f79

2 years ago

Pull-Request has been merged by zbyszek

2 years ago