-
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
feat(package): add --exclude-lockfile flag #15234
base: master
Are you sure you want to change the base?
Conversation
Mind cleaning up the commit history (reorder test first, squash test update), including updating commint message for new flag name? |
After dd698ff, `cargo package --no-verify` at least fails in three different cases: * An unpublished package depending on itself as a dev-dependency (cyclic self-referential dev-dependencies). * Can be resolved by removing the `version` field from the affected dev-dependency. * `-Zpackage-workspace` doesn't help with it. * Existing `cargo package` has `--package <pkg>` specifying certain unpublished packages. * Can be resolved by specifying all unpublished packages in one `cargo` call. * `-Zpackage-workspace` also requires all dependency versions available in the target registry when calling, so doesn't help. * `cargo package --no-verify` has been used as a kind of “plumbing commands” to create tarballs without considering dependency orders. The use cases include: * Preparing tarballs for other package managers. * Integrating into custom develop workflows for unpublished/internal crates. * Constructing custom/private registries. This commit shows the former two cases.
When `--exclude-lockfile` is enabled, `cargo package` will not verify the lock file if present, nor will it generate a new one if absent. Cargo.lock will not be included in the resulting tarball. Together with `--no-verify`, this flag decouples packaging from checking the registry index. While this is useful for some non-normal workflows that requires to assemble packages having unpublished dependencies. It is recommended to use `-Zpackage-workspace` to package the entire workspace, instead of opting out lockfile.
Was in a haste leaving the office. Sorry. |
{{#option "`--exclude-lockfile`" }} | ||
Don't include the lock file when packaging. | ||
|
||
This flag is not for general use. Always consider packaging with a lockfile. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we really want to mention this. People using cargo package
usually are already in an unusual workflow.
Thanks for stealing, very much appreciated! (Especially the part where I don't have to come up with a better name for the flag ;-)) |
What does this PR try to resolve?
Fixes #15059
Fixes #15159
This provides an escape hatch
--exclude-lockfile
for uncommon workflowsthat don't verify (
--no-verify
is passed) the build with their unpublished packagesWhen
--exclude-lockfile
is enabled,cargo package
will not verify the lock file if present,nor will it generate a new one if absent.
Cargo.lock will not be included in the resulting tarball.
Together with
--no-verify
,this flag decouples packaging from checking the registry index.
While this is useful for some non-normal workflows that requires
to assemble packages having unpublished dependencies.
It is recommended to use
-Zpackage-workspace
to package the entireworkspace, instead of opting out lockfile.
How should we test and review this PR?
The first commit was stolen from NoisyCoil@1a104b5 (credit to @NoisyCoil!)
The second added two failing cases we observed in #15059.
Additional information