classes/cargo: implement directory source redirection

Reworked the source redirection to use directory source redirection like
I've done for Gentoo. This allows us to specify all crate dependencies
in the bitbake SRC_URI and have Yocto fetch them down using our crate
fetcher and then Cargo will build without reaching out to the network.
This commit is contained in:
Doug Goldstein
2016-12-01 10:13:31 -06:00
parent 21224d76a0
commit 846454281e
2 changed files with 67 additions and 27 deletions
+8 -7
View File
@@ -38,13 +38,14 @@ cargo_do_configure () {
echo "]" >> ${CARGO_HOME}/config
# Point cargo at our local mirror of the registry
cat >> ${CARGO_HOME}/config <<EOF
[source.local]
local-registry = "${WORKDIR}/cargo_registry"
[source.crates-io]
replace-with = "local"
registry = "https://github.com/rust-lang/crates.io-index"
EOF
cat <<- EOF >> ${CARGO_HOME}/config
[source.bitbake]
directory = "${CARGO_HOME}/bitbake"
[source.crates-io]
replace-with = "bitbake"
local-registry = "/nonexistant"
EOF
echo "[target.${HOST_SYS}]" >> ${CARGO_HOME}/config
echo "linker = '${RUST_TARGET_CCLD}'" >> ${CARGO_HOME}/config