Skip to content
New issue

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

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

Already on GitHub? # to your account

fix(publish): add more check when use publish -p <SPEC> #10677

Merged
merged 13 commits into from
May 27, 2022

Conversation

likzn
Copy link
Contributor

@likzn likzn commented May 18, 2022

Main issue

As issue say #10536 , we need add more check when user use cargo publish -p <SPEC>

@ehuss point outs:
From a behavior standpoint, here are some things to check:

  • In the root of a virtual workspace, it should be an error to run without -p.
  • It should be an error to pass -p for a non-workspace member.
  • It should be an error for -p to match multiple packages.
  • When using -p, it should publish that package, not the one in the current directory (which can be different).

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ehuss (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 18, 2022
@likzn
Copy link
Contributor Author

likzn commented May 19, 2022

@ehuss PTAL~

Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to add a test for the original issue. That is, you have a package with no [workspace], and that package has a path-dependency on bar, and in the root you try to run cargo publish -p bar. That I think should be an error for now.

@likzn likzn requested a review from ehuss May 23, 2022 13:41
@likzn likzn requested a review from ehuss May 25, 2022 15:11
@ehuss
Copy link
Contributor

ehuss commented May 27, 2022

Thanks!

@bors r+

@bors
Copy link
Contributor

bors commented May 27, 2022

📌 Commit b486ada has been approved by ehuss

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 27, 2022
@bors
Copy link
Contributor

bors commented May 27, 2022

⌛ Testing commit b486ada with merge e23cf43...

@bors
Copy link
Contributor

bors commented May 27, 2022

☀️ Test successful - checks-actions
Approved by: ehuss
Pushing e23cf43 to master...

@bors bors merged commit e23cf43 into rust-lang:master May 27, 2022
@likzn likzn deleted the fix_publish_p branch May 27, 2022 01:49
@likzn
Copy link
Contributor Author

likzn commented May 27, 2022

@ehuss Thank you for your patient guidance these days! Wish the cargo community better and better!

ehuss pushed a commit to ehuss/cargo that referenced this pull request May 27, 2022
fix(publish): add more check when use `publish -p <SPEC>`

### Main issue
As issue say rust-lang#10536 , we need add more check when user use `cargo publish -p <SPEC>`

>`@ehuss` point outs:
>From a behavior standpoint, here are some things to check:
> - In the root of a virtual workspace, it should be an error to run without -p.
>- It should be an error to pass -p for a non-workspace member.
>- It should be an error for -p to match multiple packages.
>- When using -p, it should publish that package, not the one in the current directory (which can be different).
bors added a commit that referenced this pull request May 27, 2022
[beta] Backport `cargo publish` fixes

Beta backport of #10677.

I think it is a serious regression where `cargo publish` may publish the wrong package in some circumstances. I think it warrants a beta backport to get the fix out asap.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 1, 2022
Update cargo

5 commits in 39ad1039d9e3e1746177bf5d134af4c164f95528..38472bc19f2f76e245eba54a6e97ee6821b3c1db
2022-05-25 00:50:02 +0000 to 2022-05-31 02:03:24 +0000
- Emit warning upon encountering multiple packages with the same name (rust-lang/cargo#10701)
- Guide new users to add use `super::*;` to `mod test` (rust-lang/cargo#10706)
- Document how to debug change detection events (rust-lang/cargo#10708)
- fix(publish): add more check when use `publish -p &lt;SPEC&gt;` (rust-lang/cargo#10677)
- fix key formatting when switching to a dotted `WorkspaceSource` (rust-lang/cargo#10705)
@ehuss ehuss added this to the 1.62.0 milestone Jun 1, 2022
@epage epage mentioned this pull request Aug 30, 2024
bors added a commit that referenced this pull request Sep 3, 2024
Don't automatically include the current crate when packaging

This replicates some of the changes in #10677 while packaging. It was split off from #14433
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants