This adds support for an associative array called GIT_CRATES containing any crates that must be fetched from git rather than just cargo crates. This will add the code to the cargo config to make sure that the locations are overridden so cargo won't try to fetch the crates from git.
Currently it automatically handle GitHub and GitLab URIs, and will accept arbitrary URIs.
Tested-By: Georgy Yakovlev <
gyakovlev@gentoo.org>
Signed-off-by: Patrick McLean <
chutzpah@gentoo.org>
---
eclass/cargo.eclass | 103 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 103 insertions(+)
diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
index eb9d2e8c359..788663a070c 100644
--- a/eclass/cargo.eclass
+++ b/eclass/cargo.eclass
@@ -75,6 +75,43 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo"
# SRC_URI="$(cargo_crate_uris)"
# @CODE
+# @ECLASS_VARIABLE: GIT_CRATES
+# @DEFAULT_UNSET
+# @PRE_INHERIT
+# @DESCRIPTION:
+# bash associative array containing all crates that a package wants
+# to be fetch by git.
+# The key is the crate name, the value is a semicolon separated list of
+# the following fields:
+#
+# - the URI to to fetch the crate from
+# - this intelligentally handles GitHub URIs and GitLab URIs so
+# just the path is needed.
+# - the string "%commit%" gets replaced with the commit
+# - the hash of the commit to use
+# - (optional) the path to look for Cargo.toml in
+# - this will also replace the string "%commit%" with the commit
+#