Add repro-check tool for verifying reproducible Rust builds #149888
+859
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch introduces a new host tool called repro-check that helps verify whether Rust compiler builds are reproducible.
Summary:
-> Builds the stage-2 Rust toolchain (or a full distribution) twice in separate workspaces.
-> Compares the resulting sysroots byte-for-byte using SHA-256.
-> Generates a detailed HTML report highlighting mismatches and ignored files.
-> Writes a deterministic bootstrap.toml for each build to ensure consistent settings.
-> Supports parallel hashing via Rayon.
-> Accepts standard options such as:
--jobs – Number of parallel jobs
--exclude-pattern – Ignore files matching a pattern
--path-delta – Adds extra directory levels to second build for path-sensitivity testing
--full-dist – Build full distribution instead of stage 2
--clean – Start from a clean workspace
--skip-copy – Reuse existing workspace without copying source
--verbose – Print detailed logging
Included components:
-> src/tools/repro-check/ – Tool source code (main.rs, build.rs, compare.rs, fs_utils.rs, config.rs)
-> Integration tests for hash computation, mismatch detection, ignored patterns, and case-insensitive handling.
-> Updates to Cargo.toml and Cargo.lock to include repro-check dependencies.
-> Bootstrap and builder updates to register the new tool.
References:
Tracking issues: #139793, #134589, #144669
Usage:
Build the tool
./x.py build src/tools/repro-check
Run (stage2 only, host target)
./build/x86_64-unknown-linux-gnu/stage1-tools-bin/repro-check
Full distribution with custom options
./build/x86_64-unknown-linux-gnu/stage1-tools-bin/repro-check
--jobs 16
--exclude-pattern .so
--path-delta 10
--html-output my-report.html