Gentoo Archives: gentoo-commits

From: Georgy Yakovlev <gyakovlev@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Tue, 29 Sep 2020 02:03:20
Message-Id: 1601344727.6554c490d8e75e5784bd29105121dfb7aa0baca7.gyakovlev@gentoo
1 commit: 6554c490d8e75e5784bd29105121dfb7aa0baca7
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Sun Sep 27 21:27:50 2020 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Tue Sep 29 01:58:47 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6554c490
7
8 eclass/cargo.eclass: require cargo_gen_config in cargo_src* functions
9
10 cargo_gen_config sets required config values and env vars, which
11 cargo_src_{compile,test,install} rely on.
12
13 it should be called as last step of src_unpack normally, so check it did.
14 Crate sources may have been vendored or cargo is wrapped by other build
15 system and pre-fetched, so cargo_*unpack may not have been used.
16
17 In that case our config does not work for external build system,
18 our cargo_src_ functions should not be used.
19
20 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
21
22 eclass/cargo.eclass | 10 ++++++++++
23 1 file changed, 10 insertions(+)
24
25 diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
26 index dec56b48fc9..bbb3d40a620 100644
27 --- a/eclass/cargo.eclass
28 +++ b/eclass/cargo.eclass
29 @@ -265,6 +265,7 @@ cargo_gen_config() {
30 _EOF_
31
32 export CARGO_HOME="${ECARGO_HOME}"
33 + _CARGO_GEN_CONFIG_HAS_RUN=1
34 }
35
36 # @FUNCTION: cargo_src_configure
37 @@ -321,6 +322,9 @@ cargo_src_configure() {
38 cargo_src_compile() {
39 debug-print-function ${FUNCNAME} "$@"
40
41 + [[ ${_CARGO_GEN_CONFIG_HAS_RUN} ]] || \
42 + die "FATAL: please call cargo_gen_config before using ${FUNCNAME}"
43 +
44 tc-export AR CC CXX
45
46 set -- cargo build $(usex debug "" --release) ${ECARGO_ARGS[@]} "$@"
47 @@ -338,6 +342,9 @@ cargo_src_compile() {
48 cargo_src_install() {
49 debug-print-function ${FUNCNAME} "$@"
50
51 + [[ ${_CARGO_GEN_CONFIG_HAS_RUN} ]] || \
52 + die "FATAL: please call cargo_gen_config before using ${FUNCNAME}"
53 +
54 set -- cargo install $(has --path ${@} || echo --path ./) \
55 --root "${ED}/usr" \
56 $(usex debug --debug "") \
57 @@ -357,6 +364,9 @@ cargo_src_install() {
58 cargo_src_test() {
59 debug-print-function ${FUNCNAME} "$@"
60
61 + [[ ${_CARGO_GEN_CONFIG_HAS_RUN} ]] || \
62 + die "FATAL: please call cargo_gen_config before using ${FUNCNAME}"
63 +
64 set -- cargo test $(usex debug "" --release) ${ECARGO_ARGS[@]} "$@"
65 einfo "${@}"
66 "${@}" || die "cargo test failed"