cargo.eclass: make cargo verbosity configurable
authorGeorgy Yakovlev <gyakovlev@gentoo.org>
Fri, 27 Dec 2019 02:22:27 +0000 (18:22 -0800)
committerGeorgy Yakovlev <gyakovlev@gentoo.org>
Sat, 28 Dec 2019 04:59:10 +0000 (20:59 -0800)
Users can set CARGO_TERM_VERBOSE=false in make.conf if less build output is desired.
Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
eclass/cargo.eclass

index f26495fc19c839ab638336ea166b185f7650b018..d0288ed2edc902f53abcba54f2db2f7dcd400050 100644 (file)
@@ -125,7 +125,14 @@ cargo_live_src_unpack() {
 
 # @FUNCTION: cargo_gen_config
 # @DESCRIPTION:
-# Generate the $CARGO_HOME/config necessary to use our local registry
+# 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} "$@"
 
@@ -142,6 +149,9 @@ cargo_gen_config() {
 
        [build]
        jobs = $(makeopts_jobs)
+
+       [term]
+       verbose = true
        EOF
 }
 
@@ -153,7 +163,7 @@ cargo_src_compile() {
 
        export CARGO_HOME="${ECARGO_HOME}"
 
-       cargo build -vv $(usex debug "" --release) "$@" \
+       cargo build $(usex debug "" --release) "$@" \
                || die "cargo build failed"
 }
 
@@ -163,7 +173,7 @@ cargo_src_compile() {
 cargo_src_install() {
        debug-print-function ${FUNCNAME} "$@"
 
-       cargo install -vv --path ${CARGO_INSTALL_PATH} \
+       cargo install --path ${CARGO_INSTALL_PATH} \
                --root="${ED}/usr" $(usex debug --debug "") "$@" \
                || die "cargo install failed"
        rm -f "${ED}/usr/.crates.toml"
@@ -177,7 +187,7 @@ cargo_src_install() {
 cargo_src_test() {
        debug-print-function ${FUNCNAME} "$@"
 
-       cargo test -vv $(usex debug "" --release) "$@" \
+       cargo test $(usex debug "" --release) "$@" \
                || die "cargo test failed"
 }