dev-cpp/pangomm: stable 2.42.1 for hppa, bug #717144
[gentoo.git] / eclass / cargo.eclass
index f2a726d51672da052e47f0e99a37740239a0f250..6f7ffdb626b4143730f56d4f0ea9005f4b6887d8 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: cargo.eclass
@@ -39,16 +39,13 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo"
 # @DESCRIPTION:
 # Generates the URIs to put in SRC_URI to help fetch dependencies.
 cargo_crate_uris() {
+       local -r regex='^([a-zA-Z0-9_\-]+)-([0-9]+\.[0-9]+\.[0-9]+.*)$'
        local crate
        for crate in "$@"; do
-               local name version url pretag
-               name="${crate%-*}"
-               version="${crate##*-}"
-               pretag="^[a-zA-Z]+"
-               if [[ $version =~ $pretag ]]; then
-                       version="${name##*-}-${version}"
-                       name="${name%-*}"
-               fi
+               local name version url
+               [[ $crate =~ $regex ]] || die "Could not parse name and version from crate: $crate"
+               name="${BASH_REMATCH[1]}"
+               version="${BASH_REMATCH[2]}"
                url="https://crates.io/api/v1/crates/${name}/${version}/download -> ${crate}.crate"
                echo "${url}"
        done
@@ -179,6 +176,7 @@ cargo_src_install() {
                --root="${ED}/usr" $(usex debug --debug "") "$@" \
                || die "cargo install failed"
        rm -f "${ED}/usr/.crates.toml"
+       rm -f "${ED}/usr/.crates2.json"
 
        [ -d "${S}/man" ] && doman "${S}/man" || return 0
 }