diff options
| author | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2025-01-20 21:45:04 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-20 21:45:04 +0800 |
| commit | bdd88ddd309077ef2356c226f93f3fe9608eb494 (patch) | |
| tree | 3c1fc714ed3be727aa9fccc719d88e9eab6511d6 /src | |
| parent | b5741a36a897dd93936d31ea0c1688f1399a2e06 (diff) | |
| parent | 7d806171d00f53a720e6784a878a98cbef5c3d4a (diff) | |
| download | rust-bdd88ddd309077ef2356c226f93f3fe9608eb494.tar.gz rust-bdd88ddd309077ef2356c226f93f3fe9608eb494.zip | |
Rollup merge of #135433 - tanvincible:patch-1, r=onur-ozkan
Add Profile Override for Non-Git Sources
## PR description
- Fixes #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
Diffstat (limited to 'src')
| -rw-r--r-- | src/bootstrap/bootstrap.py | 5 | ||||
| -rw-r--r-- | src/bootstrap/src/core/config/config.rs | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 76ee40c6f45..74923af1555 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -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 diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index b5310108dbf..910550b0a7d 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -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. |
