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

fix(embedded): Don't pollute script dir with lockfile #12284

Merged
merged 2 commits into from
Jun 19, 2023
Merged

Conversation

epage
Copy link
Contributor

@epage epage commented Jun 17, 2023

What does this PR try to resolve?

This puts the lockfile back into a target directory in the users home,
like before #12268.

Another idea that came up was to move the workspace root to be in the
target directory (which would effectively be like pre-#12268) but I
think that is a bit hacky / misleading.

This does mean that the lockfile is buried away from the user and they
can't pass it along with their script. In most cases I've dealt with,
this would be fine. When the lockfile is needed, they will also most
likely have a workspace, so it shoud have a local lockfile in that case.
The inbetween case is something that needs further evaluation for
whether we should handle it and how.

How should we test and review this PR?

Its a bit difficult to test for the lockfile in the new location, so this is mostly being tested in that the lockfile no longer exists next to the script.

epage added 2 commits June 17, 2023 15:11
This puts the lockfile back into a target directory in the users home,
like before rust-lang#12268.

Another idea that came up was to move the workspace root to be in the
target directory (which would effectively be like pre-rust-lang#12268) but I
think that is a bit hacky / misleading.

This does mean that the lockfile is buried away from the user and they
can't pass it along with their script.  In most cases I've dealt with,
this would be fine.  When the lockfile is needed, they will also most
likely have a workspace, so it shoud have a local lockfile in that case.
The inbetween case is something that needs further evaluation for
whether we should handle it and how.
@rustbot
Copy link
Collaborator

rustbot commented Jun 17, 2023

r? @weihanglo

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added A-lockfile Area: Cargo.lock issues A-workspaces Area: workspaces S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 17, 2023
Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

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

Looks good.

Just this line ws.root() needs to be replaced with lock_root.

.with_context(|| format!("failed to write {}", ws.root().join("Cargo.lock").display()))?;

@epage
Copy link
Contributor Author

epage commented Jun 19, 2023

Thanks for catching that! I've pushed a fix

@weihanglo
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jun 19, 2023

📌 Commit bb1f6f2 has been approved by weihanglo

It is now in the queue for this repository.

@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 Jun 19, 2023
@bors
Copy link
Contributor

bors commented Jun 19, 2023

⌛ Testing commit bb1f6f2 with merge 768339b...

@bors
Copy link
Contributor

bors commented Jun 19, 2023

☀️ Test successful - checks-actions
Approved by: weihanglo
Pushing 768339b to master...

@bors bors merged commit 768339b into rust-lang:master Jun 19, 2023
@epage epage deleted the lock branch June 19, 2023 15:47
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 20, 2023
Update cargo

12 commits in 0c14026aa84ee2ec4c67460c0a18abc8519ca6b2..dead4b8740c4b6a8ed5211e37c99cf81d01c3b1c
2023-06-14 18:43:05 +0000 to 2023-06-20 20:07:17 +0000
- Convert valid feature name warning to an error. (rust-lang/cargo#12291)
- fix(embedded): Don't pollute script dir with lockfile (rust-lang/cargo#12284)
- fix: remove `-Zjobserver-per-rustc` again (rust-lang/cargo#12285)
- docs: some tweaks around `cargo test` (rust-lang/cargo#12288)
- Enable `doctest-in-workspace` by default (rust-lang/cargo#12221)
- fix(embedded): Don't auto-discover build.rs files (rust-lang/cargo#12283)
- fix(embeded): Don't pollute the scripts dir with `target/` (rust-lang/cargo#12282)
- feat: prepare for the next lockfile bump (rust-lang/cargo#12279)
- fix(embedded): Don't create an intermediate manifest (rust-lang/cargo#12268)
- refactor(embedded): Switch to `syn` for parsing doc comments (rust-lang/cargo#12258)
- fix(embedded): Align package name sanitization with cargo-new (rust-lang/cargo#12255)
- Clarify the default behavior of cargo-install. (rust-lang/cargo#12276)

r? `@ghost`
@ehuss ehuss added this to the 1.72.0 milestone Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lockfile Area: Cargo.lock issues A-workspaces Area: workspaces 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.

5 participants