Skip to content

Commit 54a9ba9

Browse files
committed
Auto merge of #46554 - kennytm:45861-step-4-5-6-7-upload-test-result-and-remove-toolstate-toml, r=<try>
[WIP] [auto-toolstate][4–8/8] Upload the toolstate result to an external git repository, and removes BuildExpectation This PR consists of 3 commits. 1. (Steps 4–6) The `toolstate.json` output previously collected is now pushed to the https://github.com/******/rust-toolstate repository. 2. (Step 7) Revert commit ab018c7, thus removing all traces of `BuildExpectation` and `toolstate.toml`. 3. (Step 8) Adjust CONTRIBUTION.md for the new procedure. These are the last steps of #45861. After this PR, the toolstate will be automatically computed and published to https://******.github.io/rust-toolstate/. There is no need to manage toolstate.toml again. Closes #45861.
2 parents 5f4b09e + ceb4bcf commit 54a9ba9

File tree

19 files changed

+313
-270
lines changed

19 files changed

+313
-270
lines changed

.travis.yml

+16-3
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ matrix:
1616
if: type = pull_request OR branch = auto
1717

1818
- env: IMAGE=dist-x86_64-linux DEPLOY=1
19-
if: branch = try OR branch = auto
19+
if: branch = try AND branch = auto
2020

2121
# "alternate" deployments, these are "nightlies" but have LLVM assertions
2222
# turned on, they're deployed to a different location primarily for
2323
# additional testing.
2424
- env: IMAGE=dist-x86_64-linux DEPLOY_ALT=1
25-
if: branch = try OR branch = auto
25+
if: branch = try AND branch = auto
2626

2727
- env: >
2828
RUST_CHECK_TARGET=dist
@@ -169,7 +169,7 @@ matrix:
169169
- env: IMAGE=x86_64-gnu-aux
170170
if: branch = auto
171171
- env: IMAGE=x86_64-gnu-tools
172-
if: branch = auto
172+
if: branch = try
173173
- env: IMAGE=x86_64-gnu-debug
174174
if: branch = auto
175175
- env: IMAGE=x86_64-gnu-nopt
@@ -179,13 +179,26 @@ matrix:
179179
- env: IMAGE=x86_64-gnu-incremental
180180
if: branch = auto
181181

182+
- stage: publish toolstate
183+
if: branch = try AND type = push
184+
before_install: []
185+
install: []
186+
cache: false
187+
sudo: false
188+
script:
189+
MESSAGE_FILE=$(mktemp -t msg.XXXXXX);
190+
. src/ci/docker/x86_64-gnu-tools/repo.sh;
191+
commit_toolstate_change "$MESSAGE_FILE" "$TRAVIS_BUILD_DIR/src/ci/docker/x86_64-gnu-tools/publish.py" "$(git rev-parse HEAD)" "$(git log --format=%s -n1 HEAD)" "$MESSAGE_FILE"
192+
182193
env:
183194
global:
184195
- SCCACHE_BUCKET=rust-lang-ci-sccache2
185196
- SCCACHE_REGION=us-west-1
186197
- AWS_ACCESS_KEY_ID=AKIAJAMV3QAMMA6AXHFQ
187198
# AWS_SECRET_ACCESS_KEY=...
188199
- secure: "j96XxTVOSUf4s4r4htIxn/fvIa5DWbMgLqWl7r8z2QfgUwscmkMXAwXuFNc7s7bGTpV/+CgDiMFFM6BAFLGKutytIF6oA02s9b+usQYnM0th7YQ2AIgm9GtMTJCJp4AoyfFmh8F2faUICBZlfVLUJ34udHEe35vOklix+0k4WDo="
200+
# TOOLSTATE_REPO_ACCESS_TOKEN=...
201+
- secure: "cFh8thThqEJLC98XKI5pfqflUzOlxsYPRW20AWRaYOOgYHPTiGWypTXiPbGSKaeAXTZoOA+DpQtEmefc0U6lt9dHc7a/MIaK6isFurjlnKYiLOeTruzyu1z7PWCeZ/jKXsU2RK/88DBtlNwfMdaMIeuKj14IVfpepPPL71ETbuk="
189202

190203
before_install:
191204
- zcat $HOME/docker/rust-ci.tar.gz | docker load || true

CONTRIBUTING.md

+21-23
Original file line numberDiff line numberDiff line change
@@ -345,26 +345,29 @@ Currently building Rust will also build the following external projects:
345345

346346
* [clippy](https://github.com/rust-lang-nursery/rust-clippy)
347347
* [miri](https://github.com/solson/miri)
348+
* [rustfmt](https://github.com/rust-lang-nursery/rustfmt)
349+
* [rls](https://github.com/rust-lang-nursery/rls/)
348350

349-
If your changes break one of these projects, you need to fix them by opening
350-
a pull request against the broken project asking to put the fix on a branch.
351-
Then you can disable the tool building via `src/tools/toolstate.toml`.
352-
Once the branch containing your fix is likely to be merged, you can point
353-
the affected submodule at this branch.
351+
We allow breakage of these tools in the nightly channel. Maintainers of these
352+
projects will be notified of the breakages and should fix them as soon as
353+
possible.
354354

355-
Don't forget to also add your changes with
355+
After the external is fixed, one could add the changes with
356356

357-
```
357+
```sh
358358
git add path/to/submodule
359359
```
360360

361361
outside the submodule.
362362

363-
In order to prepare your PR, you can run the build locally by doing
363+
In order to prepare your tool-fixing PR, you can run the build locally by doing
364364
`./x.py build src/tools/TOOL`. If you will be editing the sources
365365
there, you may wish to set `submodules = false` in the `config.toml`
366366
to prevent `x.py` from resetting to the original branch.
367367

368+
Breakage is not allowed in the beta and stable channels, and must be addressed
369+
before the PR is merged.
370+
368371
#### Breaking Tools Built With The Compiler
369372
[breaking-tools-built-with-the-compiler]: #breaking-tools-built-with-the-compiler
370373

@@ -382,12 +385,12 @@ tests.
382385
That means that, in the default state, you can't update the compiler without first
383386
fixing rustfmt, rls and the other tools that the compiler builds.
384387

385-
Luckily, a feature was [added to Rust's build](https://github.com/rust-lang/rust/pull/45243)
386-
to make all of this easy to handle. The idea is that you mark the tools as "broken",
388+
Luckily, a feature was [added to Rust's build](https://github.com/rust-lang/rust/issues/45861)
389+
to make all of this easy to handle. The idea is that we allow these tools to be "broken",
387390
so that the rust-lang/rust build passes without trying to build them, then land the change
388391
in the compiler, wait for a nightly, and go update the tools that you broke. Once you're done
389-
and the tools are working again, you go back in the compiler and change the tools back
390-
from "broken".
392+
and the tools are working again, you go back in the compiler and update the tools
393+
so they can be distributed again.
391394

392395
This should avoid a bunch of synchronization dances and is also much easier on contributors as
393396
there's no need to block on rls/rustfmt/other tools changes going upstream.
@@ -406,15 +409,10 @@ Here are those same steps in detail:
406409
4. (optional) Maintainers of these submodules will **not** merge the PR. The PR can't be
407410
merged because CI will be broken. You'll want to write a message on the PR referencing
408411
your change, and how the PR should be merged once your change makes it into a nightly.
409-
5. Update `src/tools/toolstate.toml` to indicate that the tool in question is "broken",
410-
that will disable building it on CI. See the documentation in that file for the exact
411-
configuration values you can use.
412-
6. Commit the changes to `src/tools/toolstate.toml`, **do not update submodules in your commit**,
413-
and then update the PR you have for rust-lang/rust.
414-
7. Wait for your PR to merge.
415-
8. Wait for a nightly
416-
9. (optional) Help land your PR on the upstream repository now that your changes are in nightly.
417-
10. (optional) Send a PR to rust-lang/rust updating the submodule, reverting `src/tools/toolstate.toml` back to a "building" or "testing" state.
412+
5. Wait for your PR to merge.
413+
6. Wait for a nightly
414+
7. (optional) Help land your PR on the upstream repository now that your changes are in nightly.
415+
8. (optional) Send a PR to rust-lang/rust updating the submodule.
418416

419417
#### Updating submodules
420418
[updating-submodules]: #updating-submodules
@@ -446,14 +444,14 @@ failed to run: ~/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --ma
446444
If you haven't used the `[patch]`
447445
section of `Cargo.toml` before, there is [some relevant documentation about it
448446
in the cargo docs](http://doc.crates.io/manifest.html#the-patch-section). In
449-
addition to that, you should read the
447+
addition to that, you should read the
450448
[Overriding dependencies](http://doc.crates.io/specifying-dependencies.html#overriding-dependencies)
451449
section of the documentation as well.
452450

453451
Specifically, the following [section in Overriding dependencies](http://doc.crates.io/specifying-dependencies.html#testing-a-bugfix) reveals what the problem is:
454452

455453
> Next up we need to ensure that our lock file is updated to use this new version of uuid so our project uses the locally checked out copy instead of one from crates.io. The way [patch] works is that it'll load the dependency at ../path/to/uuid and then whenever crates.io is queried for versions of uuid it'll also return the local version.
456-
>
454+
>
457455
> This means that the version number of the local checkout is significant and will affect whether the patch is used. Our manifest declared uuid = "1.0" which means we'll only resolve to >= 1.0.0, < 2.0.0, and Cargo's greedy resolution algorithm also means that we'll resolve to the maximum version within that range. Typically this doesn't matter as the version of the git repository will already be greater or match the maximum version published on crates.io, but it's important to keep this in mind!
458456
459457
This says that when we updated the submodule, the version number in our

appveyor.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ environment:
55
AWS_SECRET_ACCESS_KEY:
66
secure: 7Y+JiquYedOAgnUU26uL0DPzrxmTtR+qIwG6rNKSuWDffqU3vVZxbGXim9QpTO80
77
SCCACHE_DIGEST: f808afabb4a4eb1d7112bcb3fa6be03b61e93412890c88e177c667eb37f46353d7ec294e559b16f9f4b5e894f2185fe7670a0df15fd064889ecbd80f0c34166c
8+
TOOLSTATE_REPO_ACCESS_TOKEN:
9+
secure: PTZiSxJMVUZ0VnMR5i13E4OagbXfglj7pcskDQiKufVrDm13mLoI0vDJAEM35+bY
810

911
# By default schannel checks revocation of certificates unlike some other SSL
1012
# backends, but we've historically had problems on CI where a revocation
@@ -27,8 +29,8 @@ environment:
2729

2830
# MSVC tools tests
2931
- MSYS_BITS: 64
30-
SCRIPT: src/ci/docker/x86_64-gnu-tools/checktools.sh x.py toolstates.json
31-
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=toolstates.json
32+
SCRIPT: src/ci/docker/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstates.json windows
33+
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstates.json --enable-test-miri
3234

3335
# 32/64-bit MinGW builds.
3436
#

src/bootstrap/check.rs

+8-28
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use std::path::{PathBuf, Path};
2323
use std::process::Command;
2424
use std::io::Read;
2525

26-
use build_helper::{self, output, BuildExpectation};
26+
use build_helper::{self, output};
2727

2828
use builder::{Kind, RunConfig, ShouldRun, Builder, Compiler, Step};
2929
use cache::{INTERNER, Interned};
@@ -65,23 +65,19 @@ impl fmt::Display for TestKind {
6565
}
6666
}
6767

68-
fn try_run_expecting(build: &Build, cmd: &mut Command, expect: BuildExpectation) -> bool {
68+
fn try_run(build: &Build, cmd: &mut Command) -> bool {
6969
if !build.fail_fast {
70-
if !build.try_run(cmd, expect) {
70+
if !build.try_run(cmd) {
7171
let mut failures = build.delayed_failures.borrow_mut();
7272
failures.push(format!("{:?}", cmd));
7373
return false;
7474
}
7575
} else {
76-
build.run_expecting(cmd, expect);
76+
build.run(cmd);
7777
}
7878
true
7979
}
8080

81-
fn try_run(build: &Build, cmd: &mut Command) {
82-
try_run_expecting(build, cmd, BuildExpectation::None);
83-
}
84-
8581
fn try_run_quiet(build: &Build, cmd: &mut Command) {
8682
if !build.fail_fast {
8783
if !build.try_run_quiet(cmd) {
@@ -259,11 +255,7 @@ impl Step for Rls {
259255

260256
builder.add_rustc_lib_path(compiler, &mut cargo);
261257

262-
if try_run_expecting(
263-
build,
264-
&mut cargo,
265-
builder.build.config.toolstate.rls.passes(ToolState::Testing),
266-
) {
258+
if try_run(build, &mut cargo) {
267259
build.save_toolstate("rls", ToolState::Testing);
268260
}
269261
}
@@ -309,11 +301,7 @@ impl Step for Rustfmt {
309301

310302
builder.add_rustc_lib_path(compiler, &mut cargo);
311303

312-
if try_run_expecting(
313-
build,
314-
&mut cargo,
315-
builder.build.config.toolstate.rustfmt.passes(ToolState::Testing),
316-
) {
304+
if try_run(build, &mut cargo) {
317305
build.save_toolstate("rustfmt", ToolState::Testing);
318306
}
319307
}
@@ -360,11 +348,7 @@ impl Step for Miri {
360348

361349
builder.add_rustc_lib_path(compiler, &mut cargo);
362350

363-
if try_run_expecting(
364-
build,
365-
&mut cargo,
366-
builder.build.config.toolstate.miri.passes(ToolState::Testing),
367-
) {
351+
if try_run(build, &mut cargo) {
368352
build.save_toolstate("miri", ToolState::Testing);
369353
}
370354
} else {
@@ -419,11 +403,7 @@ impl Step for Clippy {
419403

420404
builder.add_rustc_lib_path(compiler, &mut cargo);
421405

422-
if try_run_expecting(
423-
build,
424-
&mut cargo,
425-
builder.build.config.toolstate.clippy.passes(ToolState::Testing),
426-
) {
406+
if try_run(build, &mut cargo) {
427407
build.save_toolstate("clippy-driver", ToolState::Testing);
428408
}
429409
} else {

src/bootstrap/config.rs

-15
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ use util::exe;
2727
use cache::{INTERNER, Interned};
2828
use flags::Flags;
2929
pub use flags::Subcommand;
30-
use toolstate::ToolStates;
3130

3231
/// Global configuration for the entire build and/or bootstrap.
3332
///
@@ -133,8 +132,6 @@ pub struct Config {
133132
// These are either the stage0 downloaded binaries or the locally installed ones.
134133
pub initial_cargo: PathBuf,
135134
pub initial_rustc: PathBuf,
136-
137-
pub toolstate: ToolStates,
138135
}
139136

140137
/// Per-target configuration stored in the global configuration structure.
@@ -346,18 +343,6 @@ impl Config {
346343
}
347344
}).unwrap_or_else(|| TomlConfig::default());
348345

349-
let toolstate_toml_path = config.src.join("src/tools/toolstate.toml");
350-
let parse_toolstate = || -> Result<_, Box<::std::error::Error>> {
351-
let mut f = File::open(toolstate_toml_path)?;
352-
let mut contents = String::new();
353-
f.read_to_string(&mut contents)?;
354-
Ok(toml::from_str(&contents)?)
355-
};
356-
config.toolstate = parse_toolstate().unwrap_or_else(|err| {
357-
println!("failed to parse TOML configuration 'toolstate.toml': {}", err);
358-
process::exit(2);
359-
});
360-
361346
let build = toml.build.clone().unwrap_or(Build::default());
362347
set(&mut config.build, build.build.clone().map(|x| INTERNER.intern_string(x)));
363348
set(&mut config.build, flags.build);

src/bootstrap/dist.rs

-10
Original file line numberDiff line numberDiff line change
@@ -1076,11 +1076,6 @@ impl Step for Rls {
10761076
let target = self.target;
10771077
assert!(build.config.extended);
10781078

1079-
if !builder.config.toolstate.rls.testing() {
1080-
println!("skipping Dist RLS stage{} ({})", stage, target);
1081-
return None
1082-
}
1083-
10841079
println!("Dist RLS stage{} ({})", stage, target);
10851080
let src = build.src.join("src/tools/rls");
10861081
let release_num = build.release_num("rls");
@@ -1163,11 +1158,6 @@ impl Step for Rustfmt {
11631158
let target = self.target;
11641159
assert!(build.config.extended);
11651160

1166-
if !builder.config.toolstate.rustfmt.testing() {
1167-
println!("skipping Dist Rustfmt stage{} ({})", stage, target);
1168-
return None
1169-
}
1170-
11711161
println!("Dist Rustfmt stage{} ({})", stage, target);
11721162
let src = build.src.join("src/tools/rustfmt");
11731163
let release_num = build.release_num("rustfmt");

src/bootstrap/lib.rs

+10-18
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ use std::path::{PathBuf, Path};
143143
use std::process::{self, Command};
144144
use std::slice;
145145

146-
use build_helper::{run_silent, run_suppressed, try_run_silent, try_run_suppressed, output, mtime,
147-
BuildExpectation};
146+
use build_helper::{run_silent, run_suppressed, try_run_silent, try_run_suppressed, output, mtime};
148147

149148
use util::{exe, libdir, OutputFolder, CiEnv};
150149

@@ -569,39 +568,32 @@ impl Build {
569568
.join(libdir(&self.config.build))
570569
}
571570

572-
/// Runs a command, printing out nice contextual information if its build
573-
/// status is not the expected one
574-
fn run_expecting(&self, cmd: &mut Command, expect: BuildExpectation) {
575-
self.verbose(&format!("running: {:?}", cmd));
576-
run_silent(cmd, expect)
577-
}
578-
579571
/// Runs a command, printing out nice contextual information if it fails.
580572
fn run(&self, cmd: &mut Command) {
581-
self.run_expecting(cmd, BuildExpectation::None)
573+
self.verbose(&format!("running: {:?}", cmd));
574+
run_silent(cmd)
582575
}
583576

584577
/// Runs a command, printing out nice contextual information if it fails.
585578
fn run_quiet(&self, cmd: &mut Command) {
586579
self.verbose(&format!("running: {:?}", cmd));
587-
run_suppressed(cmd, BuildExpectation::None)
580+
run_suppressed(cmd)
588581
}
589582

590-
/// Runs a command, printing out nice contextual information if its build
591-
/// status is not the expected one.
592-
/// Exits if the command failed to execute at all, otherwise returns whether
593-
/// the expectation was met
594-
fn try_run(&self, cmd: &mut Command, expect: BuildExpectation) -> bool {
583+
/// Runs a command, printing out nice contextual information if it fails.
584+
/// Exits if the command failed to execute at all, otherwise returns its
585+
/// `status.success()`.
586+
fn try_run(&self, cmd: &mut Command) -> bool {
595587
self.verbose(&format!("running: {:?}", cmd));
596-
try_run_silent(cmd, expect)
588+
try_run_silent(cmd)
597589
}
598590

599591
/// Runs a command, printing out nice contextual information if it fails.
600592
/// Exits if the command failed to execute at all, otherwise returns its
601593
/// `status.success()`.
602594
fn try_run_quiet(&self, cmd: &mut Command) -> bool {
603595
self.verbose(&format!("running: {:?}", cmd));
604-
try_run_suppressed(cmd, BuildExpectation::None)
596+
try_run_suppressed(cmd)
605597
}
606598

607599
pub fn is_verbose(&self) -> bool {

0 commit comments

Comments
 (0)