Skip to content

Commit

Permalink
Rollup merge of rust-lang#135433 - tanvincible:patch-1, r=onur-ozkan
Browse files Browse the repository at this point in the history
Add Profile Override for Non-Git Sources

## PR description

- Fixes rust-lang#135358

This PR introduces the following updates to

1. `bootstrap.py`:
    - If the `profile` is `None` and the source is non-git, the `profile` is automatically overridden to `"dist"`.
    - Ensures that options like `download-ci-llvm` and `download-rustc` are not used with non-git sources. An exception is raised if these options are present in the configuration when the source is non-git.

2. `bootstrap_test.py`
   - Added unit tests to verify both the profile override mechanism and the assertion for restricted options.
These tests ensure the correct behavior for non-git sources and the handling of `if-unchanged` options.

r? `@onur-ozkan`
`@rustbot` T-bootstrap
  • Loading branch information
jieyouxu authored Jan 20, 2025
2 parents b5741a3 + 7d80617 commit bdd88dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,11 @@ def bootstrap(args):
config_toml = ""

profile = RustBuild.get_toml_static(config_toml, "profile")
is_non_git_source = not os.path.exists(os.path.join(rust_root, ".git"))

if profile is None and is_non_git_source:
profile = "dist"

if profile is not None:
# Allows creating alias for profile names, allowing
# profiles to be renamed while maintaining back compatibility
Expand Down
6 changes: 2 additions & 4 deletions src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2931,10 +2931,8 @@ impl Config {
let if_unchanged = || {
if self.rust_info.is_from_tarball() {
// Git is needed for running "if-unchanged" logic.
println!(
"WARNING: 'if-unchanged' has no effect on tarball sources; ignoring `download-ci-llvm`."
);
return false;
println!("ERROR: 'if-unchanged' is only compatible with Git managed sources.");
crate::exit!(1);
}

// Fetching the LLVM submodule is unnecessary for self-tests.
Expand Down

0 comments on commit bdd88dd

Please sign in to comment.