diff options
author | Georgy Yakovlev <gyakovlev@gentoo.org> | 2020-09-28 18:57:55 -0700 |
---|---|---|
committer | Georgy Yakovlev <gyakovlev@gentoo.org> | 2020-09-28 19:00:46 -0700 |
commit | d8168ac771d03175117fe453a1c0f93612a1eb38 (patch) | |
tree | e80e1d5ec3657e1b3981a00266b1ba3f32526a35 /eclass | |
parent | eclass/cargo.eclass: require cargo_gen_config in cargo_src* functions (diff) | |
download | gentoo-d8168ac771d03175117fe453a1c0f93612a1eb38.tar.gz gentoo-d8168ac771d03175117fe453a1c0f93612a1eb38.tar.bz2 gentoo-d8168ac771d03175117fe453a1c0f93612a1eb38.zip |
eclass/cargo.eclass: move cargo_gen_config definition to the top
Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/cargo.eclass | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass index bbb3d40a6206..e6fec844d274 100644 --- a/eclass/cargo.eclass +++ b/eclass/cargo.eclass @@ -91,6 +91,44 @@ cargo_crate_uris() { done } +# @FUNCTION: cargo_gen_config +# @DESCRIPTION: +# Generate the $CARGO_HOME/config necessary to use our local registry and settings. +# Cargo can also be configured through environment variables in addition to the TOML syntax below. +# For each configuration key below of the form foo.bar the environment variable CARGO_FOO_BAR +# can also be used to define the value. +# Environment variables will take precedent over TOML configuration, +# and currently only integer, boolean, and string keys are supported. +# For example the build.jobs key can also be defined by CARGO_BUILD_JOBS. +# Or setting CARGO_TERM_VERBOSE=false in make.conf will make build quieter. +cargo_gen_config() { + debug-print-function ${FUNCNAME} "$@" + + mkdir -p "${ECARGO_HOME}" || die + + cat > "${ECARGO_HOME}/config" <<- _EOF_ || die "Failed to create cargo config" + [source.gentoo] + directory = "${ECARGO_VENDOR}" + + [source.crates-io] + replace-with = "gentoo" + local-registry = "/nonexistant" + + [net] + offline = true + + [build] + jobs = $(makeopts_jobs) + + [term] + verbose = true + $([[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo "color = 'never'") + _EOF_ + + export CARGO_HOME="${ECARGO_HOME}" + _CARGO_GEN_CONFIG_HAS_RUN=1 +} + # @FUNCTION: cargo_src_unpack # @DESCRIPTION: # Unpacks the package and the cargo registry @@ -230,44 +268,6 @@ cargo_live_src_unpack() { cargo_gen_config } -# @FUNCTION: cargo_gen_config -# @DESCRIPTION: -# Generate the $CARGO_HOME/config necessary to use our local registry and settings. -# Cargo can also be configured through environment variables in addition to the TOML syntax below. -# For each configuration key below of the form foo.bar the environment variable CARGO_FOO_BAR -# can also be used to define the value. -# Environment variables will take precedent over TOML configuration, -# and currently only integer, boolean, and string keys are supported. -# For example the build.jobs key can also be defined by CARGO_BUILD_JOBS. -# Or setting CARGO_TERM_VERBOSE=false in make.conf will make build quieter. -cargo_gen_config() { - debug-print-function ${FUNCNAME} "$@" - - mkdir -p "${ECARGO_HOME}" || die - - cat > "${ECARGO_HOME}/config" <<- _EOF_ || die "Failed to create cargo config" - [source.gentoo] - directory = "${ECARGO_VENDOR}" - - [source.crates-io] - replace-with = "gentoo" - local-registry = "/nonexistant" - - [net] - offline = true - - [build] - jobs = $(makeopts_jobs) - - [term] - verbose = true - $([[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo "color = 'never'") - _EOF_ - - export CARGO_HOME="${ECARGO_HOME}" - _CARGO_GEN_CONFIG_HAS_RUN=1 -} - # @FUNCTION: cargo_src_configure # @DESCRIPTION: # Configure cargo package features and arguments. |