Open redeexpressos opened 4 months ago
If you've set net.git-fetch-with-cli = true
correctly, you shouldn't have hit the code path.
I saw the log containing the cargo invocation with --manifest-path
. Chances are that the Cargo configuration file .cargo/config.toml
was not loaded correctly. They need to follow the hierarchical structure for being loaded.
What you can investigate for now is:
.cargo/config.toml
in cwd or any parent directories.CARGO_NET_GIT_FETCH_WITH_CLI
and see if it works.--manifest-path /home/ubuntu/user/builder/build/tmp/work/cortexa9t2hf-neon-poky-linux-gnueabi/A/1.0+gitAUTOINC+8c7391c38b-r0/git/Cargo.toml
ubuntu@ubuntu:/home/ubuntu/user/builder/build $ ls -al /home/ubuntu/userbuilder/build/tmp/work/cortexa9t2hf-neon-poky-linux-gnueabi/A/1.0+gitAUTOINC+8c7391c38b-r0/git/
.cargo .git .gitignore Cargo.lock Cargo.toml Cross.toml debug readme.md src
So .cargo
is there. And it has the correct config with
[net]
git-fetch-with-cli = true
CARGO_NET_GIT_FETCH_WITH_CLI
to true
, still no success.If I run the manifest command outside the shell, I can cargo build
as normal.
If helps, I'm using this to build: https://github.com/rust-embedded/meta-rust-bin/blob/master/classes/cargo_bin.bbclass
Looks like adding netrc
authentication and:
do_compile:prepend() {
export CARGO_NET_GIT_FETCH_WITH_CLI=true
}
fixed the issue.
For some reason .cargo/config
is not doing what its supposed in this shell..
It seems that the current directory is different from the Cargo package root path
/home/ubuntu/user/builder/build
/home/ubuntu/userbuilder/build/tmp/work/cortexa9t2hf-neon-poky-linux-gnueabi/A/1.0+gitAUTOINC+8c7391c38b-r0/git/
Cargo only search .cargo/config.toml
from cwd to all parent directories. If that is your cwd than it is expected, as early mentioned in a comment.
Problem
So, I'm in a custom shell (bitbake) generated by
kas
where I'm building recipes withmeta-rust-bin
that download Rust code and build them for a custom platform. I have a Rust bin A that depends on a private crateB
.A
has a.cargo/config
withgit-fetch-with-cli = true
In this shell, I cannot login manually, so everything has to be pre-set for it to fetch. Problem I am running into:A
cannot find the private crateB
viahttps
, probably because the shell is not logged in to git, so no authorization.insteadOf
method, so:git config --global url."ssh://git@workspace.com/B.git".insteadOf "https://workspace.com/B.git"
https
link and it does viassh
, which is GOOD.However, with
Cargo
, it's asking for some key. Im not sure if its the right place to ask, but might be some Cargo trick im failing. Logs:The obvious answer would be to, read logs... Yes, but Im trying to understand if there's a way of automating this.
Steps
Hard to reproduce, since its a custom Yocto Bitbake shell generated by
kas
But TLDR: Im able to git clone a private repository after insteadOF from http to ssh, but Cargo is not able to fetch it as a crate dependency.Possible Solution(s)
No response
Notes
No response
Version
No response