Do not pull optional dependencies
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
parent
f53b3e3188
commit
5d7a0b2444
2 changed files with 11 additions and 14 deletions
|
@ -2,8 +2,10 @@
|
||||||
# https://github.com/rust-lang/cargo/issues/6397
|
# https://github.com/rust-lang/cargo/issues/6397
|
||||||
# But we can set CARGO_HOME locally, which is a good idea anyway to make sure
|
# But we can set CARGO_HOME locally, which is a good idea anyway to make sure
|
||||||
# it never writes to ~/.cargo during rpmbuild.
|
# it never writes to ~/.cargo during rpmbuild.
|
||||||
%__cargo %{_bindir}/env CARGO_HOME=.cargo %{_bindir}/cargo
|
# We also need RUSTC_BOOTSTRAP since we use -Z avoid-dev-deps
|
||||||
%__cargo_common_opts %{?_smp_mflags}
|
# 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_inspector %{_bindir}/cargo-inspector
|
||||||
|
|
||||||
%cargo_registry %{_datadir}/cargo/registry
|
%cargo_registry %{_datadir}/cargo/registry
|
||||||
|
@ -36,10 +38,6 @@ registry = "https://crates.io"\
|
||||||
replace-with = "local-registry"\
|
replace-with = "local-registry"\
|
||||||
EOF\
|
EOF\
|
||||||
%{__rm} -f Cargo.lock \
|
%{__rm} -f Cargo.lock \
|
||||||
%if ! %{with check} \
|
|
||||||
# https://github.com/rust-lang/cargo/issues/3732 \
|
|
||||||
%{__awk} -i inplace -v INPLACE_SUFFIX=.orig '/^\\\[dev-dependencies/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml \
|
|
||||||
%endif \
|
|
||||||
)
|
)
|
||||||
|
|
||||||
%__cargo_parse_opts(naf:) %{shrink:\
|
%__cargo_parse_opts(naf:) %{shrink:\
|
||||||
|
@ -74,10 +72,14 @@ if %__cargo_is_lib; then \
|
||||||
CRATE_VERSION=$(%__cargo_inspector --version Cargo.toml) \
|
CRATE_VERSION=$(%__cargo_inspector --version Cargo.toml) \
|
||||||
REG_DIR=%{buildroot}%{cargo_registry}/$CRATE_NAME-$CRATE_VERSION \
|
REG_DIR=%{buildroot}%{cargo_registry}/$CRATE_NAME-$CRATE_VERSION \
|
||||||
%{__mkdir} -p $REG_DIR \
|
%{__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|build)-)?dependencies|features)/{f=1;next} /^\\\[/{f=0}; !f' Cargo.toml \
|
||||||
%{__cargo} package -l | xargs -d '\\\n' %{__cp} --parents -a -t $REG_DIR \
|
%{__cargo} package -l | xargs -d '\\\n' %{__cp} --parents -a -t $REG_DIR \
|
||||||
%if ! %{with check} \
|
%{__mv} Cargo.toml{.deps,} \
|
||||||
%{__cp} -a Cargo.toml.orig $REG_DIR/Cargo.toml \
|
%{__cp} -a Cargo.toml $REG_DIR/Cargo.toml \
|
||||||
%endif \
|
%{__rm} -f $REG_DIR/Cargo.toml.orig \
|
||||||
echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \
|
echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \
|
||||||
fi \
|
fi \
|
||||||
if %__cargo_is_bin; then \
|
if %__cargo_is_bin; then \
|
||||||
|
|
|
@ -44,12 +44,7 @@ Patch0: {{ patch_file }}
|
||||||
ExclusiveArch: %{rust_arches}
|
ExclusiveArch: %{rust_arches}
|
||||||
|
|
||||||
BuildRequires: rust-packaging
|
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.requires("default", resolve=True))|sort %}
|
||||||
#}
|
|
||||||
{% set buildrequires = normalize_deps(md.all_dependencies)|sort %}
|
|
||||||
{% for req in buildrequires %}
|
{% for req in buildrequires %}
|
||||||
BuildRequires: {{ req }}
|
BuildRequires: {{ req }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Reference in a new issue