Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cargo tries to update git submodules even with build.submodules = false and --offline #10727

Closed
brgl opened this issue Jun 3, 2022 · 3 comments
Labels
A-git Area: anything dealing with git C-bug Category: bug S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.

Comments

@brgl
Copy link

brgl commented Jun 3, 2022

Problem

For dependencies downloaded with git and containing submodules, cargo tries to update those submodules even if config.toml sets build.submodules to false and --offline flag is used.

The problem can be observed with the gst-plugins-rs project and results in the following example error:

| NOTE: cargo build -v --target x86_64-poky-linux --release --manifest-path=/home/brgl/workspace/rust-dev-yocto/build/tmp/work/core2-64-poky-linux/gstreamer1.0-plugins-rs/0.8.4-r0/git//Cargo.toml --offline
|     Updating git submodule `https://github.com/gtk-rs/gir`
| error: failed to get `gstreamer` as a dependency of package `gst-plugin-tutorial v0.8.4 (/home/brgl/workspace/rust-dev-yocto/build/tmp/work/core2-64-poky-linux/gstreamer1.0-plugins-rs/0.8.4-r0/git/tutorial)`
| 
| Caused by:
|   failed to load source for dependency `gstreamer`
| 
| Caused by:
|   Unable to update https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=0.18#9ee22baa
| 
| Caused by:
|   failed to update submodule `gir`
| 
| Caused by:
|   failed to fetch submodule `gir` from https://github.com/gtk-rs/gir
| 
| Caused by:
|   can't update a git repository in the offline mode
| WARNING: exit code 101 from a shell command.

There seems to be no way to fully disable network access and make cargo trust that the available sources are up to date.

Steps

cargo build --offline

Possible Solution(s)

No response

Notes

The problem is relevant with the yocto build system which disables name resolution when compiling and fetches all sources on its own.

Version

cargo 1.60.0
release: 1.60.0
host: x86_64-linux
libgit2: 1.3.0 (sys:0.13.23 vendored)
libcurl: 7.80.0-DEV (sys:0.4.51+curl-7.80.0 vendored ssl:OpenSSL/3.0.0c)
os: OracleLinux 22.4.0 [64-bit]
@brgl brgl added the C-bug Category: bug label Jun 3, 2022
@ehuss
Copy link
Contributor

ehuss commented Jun 3, 2022

Can you provide some more information about what actions were performed? For example, provide a Cargo.toml that demonstrates the problem, along with the exact sequence of cargo commands to run.

Cargo shouldn't update git dependencies or submodules if they are already downloaded. That means running cargo fetch or similar before going offline.

Additionally, you mention build.submodules, but that is not a configuration option that I am aware of.

@weihanglo weihanglo added the S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. label Jun 4, 2022
@brgl
Copy link
Author

brgl commented Jun 6, 2022

@ehuss the build.submodules bit I took from here: https://git.yoctoproject.org/poky/tree/meta/recipes-devtools/rust/rust.inc#n111 where the bitbake recipe prepares config.toml but haven't investigated further. I've sent a PR that addresses the problem. We don't do cargo fetch in yocto - instead we fetch all sources ourselves inside the build engine and prepare our local crate registry.

@weihanglo weihanglo added the A-git Area: anything dealing with git label Jun 8, 2022
@ehuss
Copy link
Contributor

ehuss commented Oct 23, 2022

I'm going to close per the comment at #10730 (comment).

@ehuss ehuss closed this as not planned Won't fix, can't repro, duplicate, stale Oct 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-git Area: anything dealing with git C-bug Category: bug S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.
Projects
None yet
Development

No branches or pull requests

3 participants