Skip to content

Respect CARGOFLAGS in bootstrap.py - #111979

Merged
bors merged 1 commit into
rust-lang:masterfrom
jyn514:cargoflags
May 31, 2023
Merged

Respect CARGOFLAGS in bootstrap.py#111979
bors merged 1 commit into
rust-lang:masterfrom
jyn514:cargoflags

Conversation

@jyn514

Copy link
Copy Markdown
Member

This makes it possible to pass flags to bootstrap itself, for consistency with std/rustc:

ifletOk(s) = env::var("CARGOFLAGS"){
cargo.args(s.split_whitespace());

Like RUSTFLAGS, this doesn't support CARGOFLAGS_BOOTSTRAP:
# preserve existing RUSTFLAGS
env.setdefault("RUSTFLAGS", "")

I found this useful recently when I wanted to pass -Zsparse-registry to an old checkout of the compiler from before it was stabilized in cargo.

@rustbot

Copy link
Copy Markdown
Collaborator

r? @albertlarsan68

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

@rustbotrustbot 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 May 26, 2023
@albertlarsan68

Copy link
Copy Markdown
Member

Thanks for the PR!
@bors r+

Would be great to have a test at some point

@bors

bors commented May 30, 2023

Copy link
Copy Markdown
Collaborator

📌 Commit 6674dcd has been approved by albertlarsan68

It is now in the queue for this repository.

@borsbors 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 30, 2023
@jyn514

Copy link
Copy Markdown
MemberAuthor

do you have ideas for how to test this? maybe bootstrap_test.py can inspect the command that bootstrap.py generates somehow?

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 31, 2023
Respect CARGOFLAGS in bootstrap.py
This makes it possible to pass flags to bootstrap itself, for consistency with std/rustc: https://github.com/rust-lang/rust/blob/04265621f9a82cfc2fc2278b935dcc5d4a1c39b7/src/bootstrap/builder.rs#L1446-L1447
Like RUSTFLAGS, this doesn't support CARGOFLAGS_BOOTSTRAP: https://github.com/rust-lang/rust/blob/6674dcda7a1da4c66e0aa0cfc67b27e42f4ebb34/src/bootstrap/bootstrap.py#L883-L884
I found this useful recently when I wanted to pass `-Zsparse-registry` to an old checkout of the compiler from before it was stabilized in cargo.
This was referenced May 31, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 31, 2023
Respect CARGOFLAGS in bootstrap.py
This makes it possible to pass flags to bootstrap itself, for consistency with std/rustc: https://github.com/rust-lang/rust/blob/04265621f9a82cfc2fc2278b935dcc5d4a1c39b7/src/bootstrap/builder.rs#L1446-L1447
Like RUSTFLAGS, this doesn't support CARGOFLAGS_BOOTSTRAP: https://github.com/rust-lang/rust/blob/6674dcda7a1da4c66e0aa0cfc67b27e42f4ebb34/src/bootstrap/bootstrap.py#L883-L884
I found this useful recently when I wanted to pass `-Zsparse-registry` to an old checkout of the compiler from before it was stabilized in cargo.
bors added a commit to rust-lang-ci/rust that referenced this pull request May 31, 2023
…iaskrgr
Rollup of 5 pull requests
Successful merges:
- rust-lang#111772 (Fix linkage for large binaries on mips64 platforms)
- rust-lang#111975 (Stop normalizing so many different prefixes)
- rust-lang#111979 (Respect CARGOFLAGS in bootstrap.py)
- rust-lang#112089 (Add `--warnings warn` flag to `x.py`)
- rust-lang#112103 (Bootstrap update to 1.71 beta)
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit aee05c7 into rust-lang:masterMay 31, 2023
@rustbotrustbot added this to the 1.72.0 milestone May 31, 2023
@jyn514
jyn514 deleted the cargoflags branch June 4, 2023 16:39
TaKO8Ki added a commit to TaKO8Ki/rust that referenced this pull request Jun 25, 2023
…larsan68
Test the cargo args generated by bootstrap.py
I recommend reviewing this commit-by-commit using the instructions in https://rustc-dev-guide.rust-lang.org/git.html#moving-large-sections-of-code.
- Test cargo arguments passed by bootstrap.py
This moves a lot of code around, but the logic itself is not too terribly complicated.
- Move almost all logic in `def bootstrap` to the `RustBuild` class, to avoid mixing setting configuration with running commands
- Update various doctests to the new (more complete) RustBuild config. In particular, don't pretend that `bin_root` supports `build` being unset.
- Change `parse_args` not to use a global, to allow testing it
- Set BUILD_DIR appropriately so bootstrap.py doesn't panic because cargo isn't found
- Allow passing arguments to `bootstrap_test.py`
Previous, it used the built-in test runner, which doesn't support options unless they're manually passed in the script.
- Fix progress messages for configure in bootstrap_test.py
Before it would unconditionally print `configure-args = []`.
r? `@albertlarsan68` cc rust-lang#112089rust-lang#111979 (comment)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@jyn514@rustbot@albertlarsan68@bors