• [gentoo-dev] [PATCH 2/5] cargo.eclass: Add variable alternative to $(ca

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Fri Jun 16 14:10:01 2023
    Add a helper function that sets ${CARGO_CRATE_URIS} variable to make
    it possible to set SRC_URI without subshells. This gives a slight
    speedup (~20%):

    ```
    real 300 it/s
    user 324 it/s
    ```

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/cargo.eclass | 48 +++++++++++++++++++++++++------------
    eclass/tests/cargo-bench.sh | 4 +++-
    2 files changed, 36 insertions(+), 16 deletions(-)

    diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
    index 991e808d453f..4e0cd1e4de70 100644
    --- a/eclass/cargo.eclass
    +++ b/eclass/cargo.eclass
    @@ -68,7 +68,7 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo"
    # "
    # inherit cargo
    # ...
    -# SRC_URI="$(cargo_crate_uris)"
    +# SRC_URI="${CARGO_CRATE_URIS}"
    # @CODE

    # @ECLASS_VARIABLE: GIT_CRATES
    @@ -162,31 +162,31 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo"
    # group, and then switch over to building with FEATURES=userpriv.
    # Or vice-versa.

    -# @FUNCTION: cargo_crate_uris
    +# @ECLASS_VARIABLE: CARGO_CRATE_URIS
    +# @OUTPUT_VARIABLE
    +# @DESCRIPTION:
    +# List of URIs to put in SRC_URI created from CRATES variable.
    +
    +# @FUNCTION: _cargo_set_crate_uris
    +# @USAGE: <crates>
    # @DESCRIPTION:
    # Generates the URIs to put in SRC_URI to help fetch dependencies.
    # Constructs a list of c