You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
3.1 KiB
67 lines
3.1 KiB
6 years ago
|
From ccc7ed42c168675efc4b9719dad12800b92450d5 Mon Sep 17 00:00:00 2001
|
||
6 years ago
|
From: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
||
|
Date: Sat, 9 Mar 2019 22:04:49 +0100
|
||
6 years ago
|
Subject: [PATCH 19/19] Do not pull optional dependencies
|
||
6 years ago
|
|
||
|
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
||
|
---
|
||
|
data/macros.cargo | 13 +++++++++++--
|
||
|
rust2rpm/templates/main.spec | 5 -----
|
||
|
2 files changed, 11 insertions(+), 7 deletions(-)
|
||
|
|
||
|
diff --git a/data/macros.cargo b/data/macros.cargo
|
||
6 years ago
|
index 96dc354..4e8f0c9 100644
|
||
6 years ago
|
--- a/data/macros.cargo
|
||
|
+++ b/data/macros.cargo
|
||
|
@@ -2,8 +2,10 @@
|
||
|
# https://github.com/rust-lang/cargo/issues/6397
|
||
|
# But we can set CARGO_HOME locally, which is a good idea anyway to make sure
|
||
|
# it never writes to ~/.cargo during rpmbuild.
|
||
|
-%__cargo %{_bindir}/env CARGO_HOME=.cargo %{_bindir}/cargo
|
||
|
-%__cargo_common_opts %{?_smp_mflags}
|
||
|
+# We also need RUSTC_BOOTSTRAP since we use -Z avoid-dev-deps
|
||
|
+# until it gets stabilized: https://github.com/rust-lang/cargo/issues/5133
|
||
|
+%__cargo %{_bindir}/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 %{_bindir}/cargo
|
||
|
+%__cargo_common_opts %{?_smp_mflags} -Z avoid-dev-deps
|
||
|
%__cargo_inspector %{_bindir}/cargo-inspector
|
||
|
|
||
|
%cargo_registry %{_datadir}/cargo/registry
|
||
|
@@ -74,10 +76,17 @@ if %__cargo_is_lib; then \
|
||
|
CRATE_VERSION=$(%__cargo_inspector --version Cargo.toml) \
|
||
|
REG_DIR=%{buildroot}%{cargo_registry}/$CRATE_NAME-$CRATE_VERSION \
|
||
|
%{__mkdir} -p $REG_DIR \
|
||
|
+# Drop all dependency/features information \
|
||
|
+# so that cargo doesn't fail resolving dependencies: \
|
||
|
+# https://github.com/rust-lang/cargo/pull/6729 \
|
||
|
+ %{__awk} -i inplace -v INPLACE_SUFFIX=.deps '/^\\\[((dev-)?dependencies|features)/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml \
|
||
6 years ago
|
%{__cargo} package -l | xargs -d '\\\n' %{__cp} --parents -a -t $REG_DIR \
|
||
6 years ago
|
%if ! %{with check} \
|
||
|
%{__cp} -a Cargo.toml.orig $REG_DIR/Cargo.toml \
|
||
|
+%else \
|
||
|
+ %{__cp} -a Cargo.toml.deps $REG_DIR/Cargo.toml \
|
||
|
%endif \
|
||
|
+ %{__rm} $REG_DIR/Cargo.toml.{orig,deps} \
|
||
|
echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \
|
||
|
fi \
|
||
|
if %__cargo_is_bin; then \
|
||
|
diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec
|
||
|
index 1ebef7b..f0c5445 100644
|
||
|
--- a/rust2rpm/templates/main.spec
|
||
|
+++ b/rust2rpm/templates/main.spec
|
||
|
@@ -44,12 +44,7 @@ Patch0: {{ patch_file }}
|
||
|
ExclusiveArch: %{rust_arches}
|
||
|
|
||
|
BuildRequires: rust-packaging
|
||
|
-{# We will put all non-optional and optional dependencies until
|
||
|
- https://github.com/rust-lang/cargo/issues/5133
|
||
|
- is solved
|
||
|
{% set buildrequires = normalize_deps(md.requires("default", resolve=True))|sort %}
|
||
|
-#}
|
||
|
-{% set buildrequires = normalize_deps(md.all_dependencies)|sort %}
|
||
|
{% for req in buildrequires %}
|
||
|
BuildRequires: {{ req }}
|
||
|
{% endfor %}
|
||
|
--
|
||
|
2.21.0
|
||
|
|