summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgy Yakovlev <gyakovlev@gentoo.org>2020-09-27 14:27:50 -0700
committerGeorgy Yakovlev <gyakovlev@gentoo.org>2020-09-28 18:58:47 -0700
commit6554c490d8e75e5784bd29105121dfb7aa0baca7 (patch)
tree7356e37204e35b8caa8b73585219fc07540d1118 /eclass/cargo.eclass
parenteclass/cargo.eclass: support cached downloads for live ebuilds (diff)
downloadgentoo-6554c490d8e75e5784bd29105121dfb7aa0baca7.tar.gz
gentoo-6554c490d8e75e5784bd29105121dfb7aa0baca7.tar.bz2
gentoo-6554c490d8e75e5784bd29105121dfb7aa0baca7.zip
eclass/cargo.eclass: require cargo_gen_config in cargo_src* functions
cargo_gen_config sets required config values and env vars, which cargo_src_{compile,test,install} rely on. it should be called as last step of src_unpack normally, so check it did. Crate sources may have been vendored or cargo is wrapped by other build system and pre-fetched, so cargo_*unpack may not have been used. In that case our config does not work for external build system, our cargo_src_ functions should not be used. Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
Diffstat (limited to 'eclass/cargo.eclass')
-rw-r--r--eclass/cargo.eclass10
1 files changed, 10 insertions, 0 deletions
diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
index dec56b48fc9c..bbb3d40a6206 100644
--- a/eclass/cargo.eclass
+++ b/eclass/cargo.eclass
@@ -265,6 +265,7 @@ cargo_gen_config() {
_EOF_
export CARGO_HOME="${ECARGO_HOME}"
+ _CARGO_GEN_CONFIG_HAS_RUN=1
}
# @FUNCTION: cargo_src_configure
@@ -321,6 +322,9 @@ cargo_src_configure() {
cargo_src_compile() {
debug-print-function ${FUNCNAME} "$@"
+ [[ ${_CARGO_GEN_CONFIG_HAS_RUN} ]] || \
+ die "FATAL: please call cargo_gen_config before using ${FUNCNAME}"
+
tc-export AR CC CXX
set -- cargo build $(usex debug "" --release) ${ECARGO_ARGS[@]} "$@"
@@ -338,6 +342,9 @@ cargo_src_compile() {
cargo_src_install() {
debug-print-function ${FUNCNAME} "$@"
+ [[ ${_CARGO_GEN_CONFIG_HAS_RUN} ]] || \
+ die "FATAL: please call cargo_gen_config before using ${FUNCNAME}"
+
set -- cargo install $(has --path ${@} || echo --path ./) \
--root "${ED}/usr" \
$(usex debug --debug "") \
@@ -357,6 +364,9 @@ cargo_src_install() {
cargo_src_test() {
debug-print-function ${FUNCNAME} "$@"
+ [[ ${_CARGO_GEN_CONFIG_HAS_RUN} ]] || \
+ die "FATAL: please call cargo_gen_config before using ${FUNCNAME}"
+
set -- cargo test $(usex debug "" --release) ${ECARGO_ARGS[@]} "$@"
einfo "${@}"
"${@}" || die "cargo test failed"