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

Impl warn for locked install without Cargo.lock #9108

Merged
merged 1 commit into from
Feb 1, 2021

Conversation

CPerezz
Copy link
Contributor

@CPerezz CPerezz commented Jan 28, 2021

If we're installing in --locked mode and there's no Cargo.lock published
ie. the bin was published before #7026
the cargo install errors were not stating that it was due to the lack of
the Cargo.lock file. Instead, the error seemed completely unrelated.

Therefore, this tries to address this by adding a warn in the stderr
output.

Closes #9106

I will need some help on the testing side (assuming the code I added for the warning is correct).
It looks to me that the publish function implemented for testing purposes does not publish Cargo.lock which is the actual convention. Should this be updated too? See #7026

@rust-highfive
Copy link

r? @alexcrichton

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 28, 2021
@alexcrichton
Copy link
Member

Thanks for the PR, but this is a new feature of Cargo which unfortunately isn't following our guidelines on adding new features. Existence of an issue isn't typically enough to warrant a PR to change Cargo, but rather typically discussion is needed first. We've explicitly decided in the past to not warn about this, for example, but there hasn't even been an opportunity to discuss this before this PR was created.

@CPerezz
Copy link
Contributor Author

CPerezz commented Jan 28, 2021

Thanks for the PR, but this is a new feature of Cargo which unfortunately isn't following our guidelines on adding new features. Existence of an issue isn't typically enough to warrant a PR to change Cargo, but rather typically discussion is needed first. We've explicitly decided in the past to not warn about this, for example, but there hasn't even been an opportunity to discuss this before this PR was created.

I completely understand. Apologies. I'll comment on the issue whether this decision that you took stills being the same. If that's the case, I'll close the PR. If otherways you consider that it should be closed now, feel free to do so. Thanks!

Copy link
Contributor

@dekellum dekellum left a comment

Choose a reason for hiding this comment

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

Ship it.

@alexcrichton
Copy link
Member

Gah sorry I completely misinterpreted this PR. This is a much more minor feature than I thought so this should be fine to land. I agree this is reasonable to land, and it just looks like there's some test fixes that need to happen.

@CPerezz CPerezz changed the title Impl warn for locked install withoud Cargo.lock Impl warn for locked install without Cargo.lock Jan 29, 2021
@CPerezz
Copy link
Contributor Author

CPerezz commented Jan 29, 2021

@alexcrichton Now that we agree on the landing part, I asked in the PR a question:

I will need some help on the testing side (assuming the code I added for the warning is correct).
It looks to me that the publish function implemented for testing purposes does not publish Cargo.lock which is the actual convention. Should this be updated too? See #7026

This is the help I need in order to understand whether or not the testing has to go on the direction I'm moving towards.

@ehuss
Copy link
Contributor

ehuss commented Jan 29, 2021

The Package::publish function doesn't automatically build a Cargo.lock file, and I don't think it should. For tests that specifically need a Cargo.lock, that can be included manually (here is an example).

For testing that cargo publish actually uploads a Cargo.lock, those tests actually call cargo publish.

For this PR, I think you can just take out the call to fs::remove_file.

@alexcrichton
Copy link
Member

Apologies again, my reading skills clearly need to improve...

@CPerezz
Copy link
Contributor Author

CPerezz commented Jan 29, 2021

No worries at all @alexcrichton !

The PR is ready for review btw! 😃

If we're installing in --locked mode and there's no `Cargo.lock` published
ie. the bin was published before rust-lang#7026
the cargo install errors were not stating that it was due to the lack of
the `Cargo.lock` file. Instead, the error seemed completely unrelated.

Therefore, this tries to address this by adding a warn in the stderr
output.

Closes rust-lang#9106
@alexcrichton
Copy link
Member

@bors: r+

Thanks! Sorry again for the confusion @CPerezz :(

@bors
Copy link
Collaborator

bors commented Feb 1, 2021

📌 Commit b526fad has been approved by alexcrichton

@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 Feb 1, 2021
@bors
Copy link
Collaborator

bors commented Feb 1, 2021

⌛ Testing commit b526fad with merge e099df2...

@bors
Copy link
Collaborator

bors commented Feb 1, 2021

☀️ Test successful - checks-actions
Approved by: alexcrichton
Pushing e099df2 to master...

@bors bors merged commit e099df2 into rust-lang:master Feb 1, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 2, 2021
Update cargo

5 commits in c3abcfe8a75901c7c701557a728941e8fb19399e..e099df243bb2495b9b197f79c19f124032b1e778
2021-01-25 16:16:43 +0000 to 2021-02-01 16:24:34 +0000
- Impl warn for locked install without Cargo.lock (rust-lang/cargo#9108)
- Document -Z extra-link-arg. (rust-lang/cargo#9121)
- Flip 'foo' and 'bar' to be consistent (rust-lang/cargo#9120)
- Don't try to parse MSRV if feature is not enabled (rust-lang/cargo#9115)
- simplify char range check (rust-lang/cargo#9110)
@ehuss ehuss added this to the 1.51.0 milestone Feb 6, 2022
@CPerezz CPerezz deleted the locked_warn branch January 17, 2023 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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.

Add warning when cargo install --locked used, but there is no Cargo.lock available
6 participants