-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 package silently ignores patch entries when additional binaries are present #11181
Comments
Note that the reproductions steps above depend on |
Unfortunately I think the intended behavior is the opposite of this. When generating the Without It does seem like it should maybe validate that the upload will succeed even without a It's not clear to me what your underlying use case is. If you could maybe say more about why you are running |
As I understand there are two places that the
Is my understanding accurate of these ☝🏻? I believe that the I believe that for that first step Cargo should be behaving like it does for any other command: It should be reading the manifest to learn about the package that it is going to take into the job it has to do. About my specific use case: Tl;dr: I package a group of crates that live in a workspace and have interdependencies on each other. I package them first, then publish them later. The long version is that I package them first before publishing as part of building a directory-source to use as source-replacement. Once the directory-source is constructed I use it as source-replacement for crates.io and run package verification. The script/workflow is here: https://github.com/stellar/actions/blob/main/.github/workflows/rust-publish-dry-run.yml. I do this to verify interdependent workspace crates before publishing. |
There are a few steps in-between. https://doc.rust-lang.org/cargo/commands/cargo-package.html#description has a user-level description, but in general it is:
Cargo has to be able to run the resolver to generate the |
Does this only apply if the binaries are additional binaries? Or also if there only one target and it's a binary? Because I don't see the problem for crates that only have a single binary as output. I only see the issue with crates where the binaries are in addition to a lib.
I'm seeing the problem behavior even when a Cargo.lock exists and doesn't need recreating. |
It is added if there are any binaries (or example binaries).
It shouldn't matter whether or not there is a library. If you can put together a reproduction that exhibits that difference, I can take a look.
Cargo doesn't know whether or not it needs updating. |
Problem
Running
cargo package --no-verify
successfully packages crates in a workspace using the[patch.crates-io]
entries when validating the Cargo.toml file.Running the same command fails in a workspace that has a crate with
[[bin]]
in its Cargo.toml file, or an additional binary in asrc/bin/...
file because the[patch]
entries get silently ignored.Steps
git clone https://github.com/stellar/rs-soroban-env
cd rs-soroban-env
git fetch origin pull/530/head:pr530
git checkout pr530
cargo package --no-verify -p soroban-env-host
# will run without contacting crates.io.git checkout HEAD~1
# go back one commitcargo package --no-verify -p soroban-env-host
# will fail after contacting crates.io and not finding a workspace crate dependency not published.The only difference between the two commits is the removal of the additional binary.
Possible Solution(s)
This problem seems similar to:
Cargo package should use the patch entries when validating the toml regardless of whether there are
[[bin]]
or additional binaries present.Notes
This is an important capability because it allows a workspace to package its crates that have interdependencies without those crates being published, by allowing those crates to specify
[patch.crates-io]
path entries.Version
The text was updated successfully, but these errors were encountered: