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

bootstrap: handle vendored sources when remapping crate paths #119582

Merged
merged 1 commit into from
Jan 19, 2024

Conversation

arlosi
Copy link
Contributor

@arlosi arlosi commented Jan 4, 2024

#115872 introduced a feature to add path remapping for crate dependencies, but only when they came from Cargo's registry cache, not a vendor directory.

This caused builds that used remapped debuginfo and vendor directories to fail with:

std::fs::read_dir(registry_src) failed with No such file or directory (os error 2)

or (if the registry/src directory exists but is empty)

error: --remap-path-prefix must contain '=' between FROM and TO

Fixes #117885 by explicitly supporting the vendor directory and adding it to RUSTC_CARGO_REGISTRY_SRC_TO_REMAP.

Note that bootstrap.py already assumes that ./vendor within the rust repo is the only supported vendoring location.

r? @pietroalbini

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jan 4, 2024
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.

Note that bootstrap.py already assumes that ./vendor within the rust repo is the only supported vendoring location.

For the reference:

if self.use_vendored_sources:
vendor_dir = os.path.join(self.rust_root, 'vendor')

@wesleywiser
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jan 18, 2024

📌 Commit 4b7e0a0 has been approved by wesleywiser

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 Jan 18, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 18, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#119582 (bootstrap: handle vendored sources when remapping crate paths)
 - rust-lang#119730 (docs: fix typos)
 - rust-lang#119828 (Improved collapse_debuginfo attribute, added command-line flag)
 - rust-lang#119869 (replace `track_errors` usages with bubbling up `ErrorGuaranteed`)
 - rust-lang#120037 (Remove `next_root_ty_var`)
 - rust-lang#120094 (tests/ui/asm/inline-syntax: adapt for LLVM 18)
 - rust-lang#120096 (Set RUSTC_BOOTSTRAP=1 consistently)
 - rust-lang#120101 (change `.unwrap()` to `?` on write where `fmt::Result` is returned)
 - rust-lang#120102 (Fix typo in munmap_partial.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 19, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#119582 (bootstrap: handle vendored sources when remapping crate paths)
 - rust-lang#119730 (docs: fix typos)
 - rust-lang#119828 (Improved collapse_debuginfo attribute, added command-line flag)
 - rust-lang#119869 (replace `track_errors` usages with bubbling up `ErrorGuaranteed`)
 - rust-lang#120037 (Remove `next_root_ty_var`)
 - rust-lang#120094 (tests/ui/asm/inline-syntax: adapt for LLVM 18)
 - rust-lang#120096 (Set RUSTC_BOOTSTRAP=1 consistently)
 - rust-lang#120101 (change `.unwrap()` to `?` on write where `fmt::Result` is returned)
 - rust-lang#120102 (Fix typo in munmap_partial.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 1caa419 into rust-lang:master Jan 19, 2024
11 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 19, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 19, 2024
Rollup merge of rust-lang#119582 - arlosi:bootstrap-vendor-remap, r=wesleywiser

bootstrap: handle vendored sources when remapping crate paths

rust-lang#115872 introduced a feature to add path remapping for crate dependencies, but only when they came from Cargo's registry cache, not a vendor directory.

This caused builds that used remapped debuginfo and vendor directories to fail with:
```
std::fs::read_dir(registry_src) failed with No such file or directory (os error 2)
```
or (if the `registry/src` directory exists but is empty)
```
error: --remap-path-prefix must contain '=' between FROM and TO
```

Fixes rust-lang#117885 by explicitly supporting the `vendor` directory and adding it to `RUSTC_CARGO_REGISTRY_SRC_TO_REMAP`.

Note that `bootstrap.py` already assumes that `./vendor` within the rust repo is the only supported vendoring location.

r? `@pietroalbini`
@arlosi arlosi deleted the bootstrap-vendor-remap branch January 19, 2024 15:28
bors-ferrocene bot added a commit to ferrocene/ferrocene that referenced this pull request Apr 12, 2024
510: Handle vendored sources when remapping paths r=Hoverbear a=pietroalbini

This PR backports rust-lang/rust#119582 to 1.76, allowing to build Ferrocene 24.05 with vendored dependencies.

Co-authored-by: Arlo Siemsen <arsiem@microsoft.com>
pothos added a commit to flatcar/scripts that referenced this pull request Apr 17, 2024
The patch rust-lang/rust#119582 got merged some
releases ago as alternative to the patch
rust-lang/rust#119445 we included in the ebuild
file. We currently use both because the unneeded patch got changed to
apply again but it's not needed and may cause strange behavior.
Therefore, drop the alternative patch.
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. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
6 participants