commit:     22e6f49add5eb11715f230a50790c0eecf4f5f1f
Author:     Dirkjan Ochtman <djc <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  9 13:26:59 2017 +0000
Commit:     Dirkjan Ochtman <djc <AT> gentoo <DOT> org>
CommitDate: Sat Sep  9 13:26:59 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=22e6f49a

eclass: improve cargo.eclass to better handle pre-release versions (fixes bug 
630428)

 eclass/cargo.eclass | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
index b08aa9e28aa..f805deba70c 100644
--- a/eclass/cargo.eclass
+++ b/eclass/cargo.eclass
@@ -31,9 +31,14 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo"
 cargo_crate_uris() {
        local crate
        for crate in "$@"; do
-               local name version url
+               local name version url pretag
                name="${crate%-*}"
                version="${crate##*-}"
+               pretag="[a-zA-Z]+"
+               if [[ $version =~ $pretag ]]; then
+                       version="${name##*-}-${version}"
+                       name="${name%-*}"
+               fi
                
url="https://crates.io/api/v1/crates/${name}/${version}/download -> 
${crate}.crate"
                echo "${url}"
        done

Reply via email to