-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 publish
does not convert relative paths when normalizing Cargo.toml
#11971
Comments
To ensure I understand, the published package should have If so, the problem with that is it would point outside of the |
Eh, there are two conflicting problems here, so I guess it's a no-win scenario. Fixup of OTOH, without knowing what was the original path relative to repository root, it's difficult if not impossible to correctly interpret relative URLs in the README's markdown. The problem is when markdown contains I guess I can use |
It may or may not help. Just FYI we've got env |
I try |
Problem
When packaging, Cargo replaces inherited
foo.workspace = true
fields with their actual values from the workspace.Cargo seems to be substituting the
readme
field with literal value from the workspace. However, the meaning of paths inreadme
andlicense-file
file is different when the crate is used outside of a workspace, so the path needs to be adjusted accordingly.When publishing a crate with
readme.workspace = true
, the published value isreadme = "README.md"
(same as in workspace'sCargo.toml
), but the path is taken from the workspace in a parent directory, so the resolved value should be changed toreadme = "../README.md"
(or wherever the workspace is).Steps
Example:
https://docs.rs/crate/zsplit-cli/0.3.0/source/Cargo.toml.orig
readme.workspace=true
meant theREADME.md
relative to the workspace, so in the workspace root.https://docs.rs/crate/zsplit-cli/0.3.0/source/Cargo.toml
the published
Cargo.toml
hasreadme = "README.md"
, but without workspace that now means relative to the crate, and the crate is inzsplit-cli/
directory,https://docs.rs/crate/zsplit-cli/0.3.0/source/.cargo_vcs_info.json
so the readme path changed from
root/README.md
toroot/zsplit-cli/README.md
.Possible Solution(s)
normalization that resolves workspace inheritance needs to change base of the paths from the root to the crate's directory.
Notes
No response
Version
No response
The text was updated successfully, but these errors were encountered: