Pass %__cargo_common_opts to %cargo_install

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
epel9
Igor Gnatenko 7 years ago
parent 210d2aa95c
commit 6e2f4c8378
No known key found for this signature in database
GPG Key ID: 695714BD1BBC5F4C

@ -1,7 +1,7 @@
From 5313b352712486b4001827b04d906bdb91be2314 Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
Date: Mon, 8 Jan 2018 23:57:03 +0100
Subject: [PATCH 1/2] macros: remove Cargo.lock
Subject: [PATCH 1/3] macros: remove Cargo.lock
cargo-package automatically strips it out, but we package also some
things directly from git.
@ -27,5 +27,5 @@ index ebf3edb..288554c 100644
# 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 \
--
2.15.1
2.16.2

@ -1,7 +1,7 @@
From cd6329635329fc7742a18f7ed0933298a0c56cf7 Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
Date: Tue, 9 Jan 2018 06:52:36 +0100
Subject: [PATCH 2/2] macros: remove spurious whitespace
Subject: [PATCH 2/3] macros: remove spurious whitespace
Fixes: https://pagure.io/fedora-rust/rust2rpm/issue/48
Reported-by: Josh Stone <jistone@redhat.com>
@ -24,5 +24,5 @@ index 288554c..67b1950 100644
%if ! %{with check} \
# https://github.com/rust-lang/cargo/issues/3732 \
--
2.15.1
2.16.2

@ -0,0 +1,50 @@
From c5bab762f56bf07cd0f4a2e2d58b7c295cddedd8 Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
Date: Tue, 20 Feb 2018 22:04:35 +0100
Subject: [PATCH 3/3] macros: pass %__cargo_common_opts to %cargo_install
Reason this has not been done before is that cargo-install doesn't
understand --release. Let's just add it to other commands and be done
with it.
Reported-by: Josh Stone <jistone@redhat.com>
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
---
data/macros.cargo | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/data/macros.cargo b/data/macros.cargo
index 67b1950..22721e9 100644
--- a/data/macros.cargo
+++ b/data/macros.cargo
@@ -1,5 +1,5 @@
%__cargo %{_bindir}/cargo
-%__cargo_common_opts --release %{?_smp_mflags}
+%__cargo_common_opts %{?_smp_mflags}
%__cargo_inspector %{_bindir}/cargo-inspector
%cargo_registry %{_datadir}/cargo/registry
@@ -35,9 +35,9 @@ EOF\
%endif \
)
-%cargo_build %__cargo build %{__cargo_common_opts}
+%cargo_build %__cargo build --release %{__cargo_common_opts}
-%cargo_test %__cargo test %{__cargo_common_opts} --no-fail-fast
+%cargo_test %__cargo test --release %{__cargo_common_opts} --no-fail-fast
%cargo_install (\
set -eu \
@@ -53,7 +53,7 @@ if %__cargo_is_lib; then \
echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \
fi \
if %__cargo_is_bin; then \
- %__cargo install %{?_smp_mflags} --path . --root %{buildroot}%{_prefix} \
+ %__cargo install %{__cargo_common_opts} --path . --root %{buildroot}%{_prefix} \
%{__rm} %{buildroot}%{_prefix}/.crates.toml \
fi \
)
--
2.16.2

@ -2,7 +2,7 @@
Name: rust-packaging
Version: 5
Release: 5%{?dist}
Release: 6%{?dist}
Summary: RPM macros for building Rust packages on various architectures
License: MIT
@ -10,6 +10,7 @@ URL: https://pagure.io/fedora-rust/rust2rpm
Source0: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz
Patch0001: 0001-macros-remove-Cargo.lock.patch
Patch0002: 0002-macros-remove-spurious-whitespace.patch
Patch0003: 0003-macros-pass-__cargo_common_opts-to-cargo_install.patch
BuildArch: noarch
ExclusiveArch: %{rust_arches} noarch
@ -41,9 +42,6 @@ Requires: python3-semantic_version
Requires: python3-jinja2
Requires: python3-requests
Requires: python3-tqdm
%if 0%{?mageia}
Requires: locales-en
%endif
Obsoletes: rust2rpm < 1-8
Provides: rust2rpm = %{version}-%{release}
%{?python_provide:%python_provide python3-rust2rpm}
@ -53,15 +51,6 @@ Provides: rust2rpm = %{version}-%{release}
%prep
%autosetup -n rust2rpm-%{version} -p1
lang=
%if 0%{?rhel} && 0%{?rhel} <= 7
lang=C.UTF-8
%else
%if 0%{?mageia}
lang=en_US.UTF-8
%endif
%endif
[ -z "$lang" ] || sed -r -i -e "s|(%\{_bindir\}/cargo-inspector)|env LANG=$lang \1|" data/cargo.attr data/macros.cargo
%build
%py3_build
@ -89,6 +78,9 @@ py.test-%{python3_version} -vv test.py
%{python3_sitelib}/rust2rpm/
%changelog
* Wed Feb 21 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 5-6
- Pass %%__cargo_common_opts to %%cargo_install
* Tue Feb 20 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 5-5
- Explicitly require rust/cargo

Loading…
Cancel
Save