about summary refs log tree commit diff
path: root/src/bootstrap/bootstrap.py
AgeCommit message (Collapse)AuthorLines
2023-12-16make x.py clippy download and use beta clippyasquared31415-16/+0
2023-12-05add comment about keeping flags in sync between bootstrap.py and bootstrap.rsRalf Jung-0/+2
2023-11-26give dev-friendly error message for incorrect config profilesonur-ozkan-0/+5
before this change, an incorrect profile would result in the following error: ```sh ... ... File "/home/nimda/devspace/onur-ozkan/rust/src/bootstrap/bootstrap.py", line 1088, in bootstrap with open(include_path) as included_toml: ^^^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: '/home/nimda/devspace/onur-ozkan/rust/src/bootstrap/defaults/config.aaaa.toml' ``` with this change, the error message is now: ```sh ... ... File "/home/nimda/devspace/onur-ozkan/rust/src/bootstrap/bootstrap.py", line 1088, in bootstrap raise Exception("Unrecognized profile '{}'. Check src/bootstrap/defaults" Exception: Unrecognized profile 'aaaa'. Check src/bootstrap/defaults for available options. ``` Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-11-09chore(bootstrap): capitalize {error, warning, info, note} tagsonur-ozkan-8/+8
This should enhance the readability. Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-10-08Add RUSTFLAGS_BOOTSTRAP to RUSTFLAGS for bootstrap compilationonur-ozkan-0/+7
Note that RUSTFLAGS_BOOTSTRAP should always be added to the end of RUSTFLAGS to be actually effective (e.g., if we have `-Dwarnings` in RUSTFLAGS, passing `-Awarnings` from RUSTFLAGS_BOOTSTRAP should override it). Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-10-01Rollup merge of #116292 - onur-ozkan:warn-wrong-sources, r=clubby789Matthias Krüger-0/+6
warn if source is not either a git clone or a dist tarball When the repository is downloaded directly via HTTP(as in #115041), builds may fail due to missing submodules. This PR adds a check that warns people in such cases.
2023-09-30warn if source is not either a git clone or a dist tarballonur-ozkan-0/+6
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-09-25ref(bootstrap.py): add `eprint` functionPouriya Jahanbakhsh-49/+41
just like `print` but for `stderr`
2023-09-21added support for GNU/HurdSamuel Thibault-1/+3
2023-09-13Adjust commentKai Luo-2/+2
2023-09-13Adjust commentKai Luo-2/+2
2023-09-13Add comment to elaborateKai Luo-0/+6
2023-09-13Make AIX known by bootstrapKai Luo-0/+2
2023-08-31Auto merge of #115323 - onur-ozkan:curl-download-checksum-fix, r=Mark-Simulacrumbors-10/+9
avoid stdout redirection on `curl` executions Avoid redirecting the curl output directly to the stdout. This alteration affects the integrity of the file during the retry process, as it also redirects the logs from the retries. Consequently, this leads to the bootstrap process failing because of an invalid checksum. For more information, see the [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/checksum.20errors) Fixes #115275
2023-08-28avoid stdout redirection on `curl` executionsonur-ozkan-10/+9
Avoid redirecting the curl output directly to the stdout. This alteration affects the integrity of the file during the retry process, as it also redirects the logs from the retries. Consequently, this leads to the bootstrap process failing because of an invalid checksum. Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-08-23Accommodate tidy.Felix S. Klock II-9/+7
In addition: Incorporated some review feedback (namely, removed a useless initial assignment to True that was never read), and unified code a bit more between bootstrap.py and download.rs (by using the same variable name for the same concept).
2023-08-22Better diagnostics for people using nix subshell on non-NixOS.Felix S. Klock II-4/+19
1. Turned patch-binaries-for-nix from a boolean into a ternary flag: true, false, and unset. 2. When patch-binaries-for-nix is unset, we continue with the existing NixOS detection heuristic (look for nixos in /etc/os-release, if present), but if we are not atop NixOS, then issue a note if we see the IN_NIX_SHELL environment variable telling the user to consider setting patch-binaries-for-nix explicitly.
2023-08-22drive-by fix to Python doc comment.Felix S. Klock II-1/+1
2023-08-22Always use `os-release` rather than `/lib` to detect `NixOS`Ethan Brierley-7/+2
[Two users over on zulip](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Bootstrapping.20on.20NixOS) bumped into issues where NixOS wasn't being properly detected. I believe this was caused by the presence of `/lib` on their machines. `/lib` is not standard on NixOS but can still be created by users or scripts. We are already checking `/etc/os-release`. The presence of `ID=nixos` in it's output should be trustworthy and we shouldn't then go on to also check for `/lib`.
2023-08-14add a csky-unknown-linux-gnuabiv2 targetDirreke-0/+1
2023-08-02Fix recent python linting errorsTrevor Gross-1/+3
- Remove unneeded imports in 'fuscia-test-runner.py' - Add explicit stacklevel to 'x.py' - Fix mutable types as default args in `bootstrap.py` and `bootstrap_test.py`
2023-07-15Rollup merge of #113683 - ozkanonur:polished, r=jyn514Matthias Krüger-6/+1
remove outdated `FIXME`s in bootstrap internals self-explanatory
2023-07-14don't print download progress in CIjyn-1/+1
2023-07-14remove outdated FIXMEs on bootstrapozkanonur-6/+1
Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-07-12Fix bootstrap.py uname error.Edgar Luque-1/+1
The x.py script fails with `ValueError: too many values to unpack (expected 3)` when uname -smp gives more than 3 words
2023-06-26bootstrap: rename 'user' profile to 'dist'clubby789-1/+7
2023-06-26Rollup merge of #111326 - he32:netbsd-aarch64-be, r=oli-obkMatthias Krüger-0/+1
Add support for NetBSD/aarch64-be (big-endian arm64).
2023-06-25fix some bugsjyn-0/+2
- fix tests when `--build` is set - don't leak `config.example.toml` fd - don't crash if `config.toml` doesn't exist yet
2023-06-24Don't test the profile override hackjyn-12/+15
It generates invalid TOML. I want to get rid of it eventually, but this avoids the issue in the meantime.
2023-06-23Test color/verbose/warnings properlyjyn-15/+19
These weren't being passed in to bootstrap consistently before; in particular `serialize_and_parse` forgot to pass them in.
2023-06-23Test cargo arguments passed by bootstrap.pyjyn-61/+64
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
2023-06-16Apply changes to fix python linting errorsTrevor Gross-2/+2
2023-05-31Rollup merge of #112089 - Kobzol:bootstrap-warnings, r=jyn514Matthias Krüger-3/+8
Add `--warnings warn` flag to `x.py` So that bootstrap itself can be built with warnings not being treated as errors. Fixes: https://github.com/rust-lang/rust/issues/76805 r? ```@jyn514```
2023-05-31Rollup merge of #111979 - jyn514:cargoflags, r=albertlarsan68Matthias Krüger-0/+4
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.
2023-05-30Add `--warnings warn` flag to `x.py`Jakub Beránek-3/+8
So that bootstrap itself can be built with warnings not being treated as errors.
2023-05-29Fix linkage for large binaries on mips64 platforms ...Ximin Luo-0/+6
... by enabling xgot feature Co-Authored-By: Zixing Liu <zixing.liu@canonical.com>
2023-05-26Auto merge of #111562 - clubby789:speedup-bootstrap-py, r=jyn514bors-49/+44
Improve startup time of bootstrap ~~If the user has a `build/host` symlink set up, we can determine the target triple by reading it rather than invoking rustc. This significantly reduces startup time of bootstrap once any kind of build has been done~~ New approach explained below ``` ➜ hyperfine -p 'git checkout -q master' -N './x.py -h' -r 50 Benchmark 1: ./x.py -h Time (mean ± σ): 140.7 ms ± 2.6 ms [User: 99.9 ms, System: 39.3 ms] Range (min … max): 136.8 ms … 149.6 ms 50 runs ➜ rust git:(master) hyperfine -p 'git checkout -q speedup-bootstrap-py' -N './x.py -h' -r 50 Benchmark 1: ./x.py -h Time (mean ± σ): 95.2 ms ± 1.5 ms [User: 67.7 ms, System: 26.7 ms] Range (min … max): 92.9 ms … 99.6 ms 50 runs ``` Also a small microoptimisation in using string splitting rather than regex when reading toml, which saves a few more milliseconds (2-5 testing locally), but less important. Profiling shows the remaining runtime is around half setting up the Python runtime, and the vast majority of the remaining time is spent in subprocess building and running bootstrap itself, so probably can't be improved much further.
2023-05-26Improve startup time for bootstrap.pyclubby789-49/+44
2023-05-25respect CARGOFLAGS in bootstrap.pyjyn-0/+4
2023-05-19Set the timestamp of downloaded stage0 files ...Ximin Luo-1/+1
... using server-reported timestamp. This allows us to track changes to the downloaded artifact more easily and in a more reproducible manner. Co-authored-by: Zixing Liu <zixing.liu@canonical.com>
2023-05-07Add support for NetBSD/aarch64-be (big-endian arm64).Havard Eidnes-0/+1
2023-05-01Make x.py work again in most (all?) casesAlbert Larsan-1/+19
Wrap all of x.py in `if __name__ == '__main__':` to avoid problems with `multiprocessing` Make the pool sizing better
2023-04-30Auto merge of #110427 - Nilstrieb:parallel-bootstrap-startup, r=albertlarsan68bors-15/+86
Parallelize initial Rust download in bootstrap Parallelize the initial download of Rust in `bootstrap.py` `time ./x.py --help` after `rm -r build` Before: 33s After: 27s
2023-04-30Parallelize initial rust extractionNilstrieb-2/+68
This is quite slow and embarassingly parallel, even in python. This speeds up the initial bootstrap build by about 5-10s.
2023-04-30Rollup merge of #110999 - clubby789:bootstrap-stderr, r=Mark-SimulacrumMatthias Krüger-33/+43
Output some bootstrap messages on stderr Fixes #110995
2023-04-29Output some bootstrap messages on stderrclubby789-33/+43
2023-04-29windows: kill rust-analyzer-proc-macro-srv before deleting stage0 directoryjyn-6/+29
This fixes the following recurring error on windows: ``` Traceback (most recent call last): File "C:\Users\jyn\src\rust\x.py", line 29, in <module> bootstrap.main() File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 963, in main bootstrap(args) File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 927, in bootstrap build.download_toolchain() File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 437, in download_toolchain shutil.rmtree(bin_root) File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 759, in rmtree return _rmtree_unsafe(path, onerror) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 617, in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 622, in _rmtree_unsafe onerror(os.unlink, fullname, sys.exc_info()) File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 620, in _rmtree_unsafe os.unlink(fullname) PermissionError: [WinError 5] Access is denied: 'C:\\Users\\jyn\\src\\rust\\build\\x86_64-pc-windows-msvc\\stage0\\bin\\rust-analyzer-proc-macro-srv.exe' ```
2023-04-27Comment round #1John Kelly-2/+3
2023-04-27Skip rustc version detection on macOSJohn Kelly-13/+18
2023-04-22Group entire build steps in the gha logsOli Scherer-2/+8