From e78ecd2e70961e64040598a019febec44959f7dd Mon Sep 17 00:00:00 2001 From: Mark Simulacrum Date: Thu, 15 Feb 2018 18:01:26 -0700 Subject: [PATCH 1/3] Prevent silently ignoring unmatched paths Primarily for CI purposes; this is intended to avoid cases where we update rustbuild and unintentionally make CI stop running some builds to the arguments being passed no longer applying for some reason. --- src/bootstrap/builder.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 001ae7246fdf2..22a128e38e804 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -217,7 +217,7 @@ impl StepDescription { } if !attempted_run { - eprintln!("Warning: no rules matched {}.", path.display()); + panic!("Error: no rules matched {}.", path.display()); } } } From 366a65665aed84fda50e4ea8bc905153ffcc1287 Mon Sep 17 00:00:00 2001 From: Mark Simulacrum Date: Thu, 15 Feb 2018 18:12:04 -0700 Subject: [PATCH 2/3] Consider paths passed to x.py to be root-relative. We'd previously assumed that these paths would be relative to the src dir, and that for example our various CI scripts would, when calling x.py, use `../x.py build ../src/tools/...` but this isn't the case -- they use `../x.py` without using the relevant source-relative path. We eventually may want to make this (actually somewhat logical) change, but this is not that time. --- src/bootstrap/builder.rs | 4 ++++ src/bootstrap/flags.rs | 8 ++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 22a128e38e804..7345b284dc70a 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -385,6 +385,10 @@ impl<'a> Builder<'a> { Subcommand::Clean { .. } => panic!(), }; + if paths[0] == Path::new("nonexistent/path/to/trigger/cargo/metadata") { + return; + } + let builder = Builder { build, top_stage: build.config.stage.unwrap_or(2), diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index 8a38fedc6136d..42b949527e09d 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -278,9 +278,7 @@ Arguments: let src = matches.opt_str("src").map(PathBuf::from) .or_else(|| env::var_os("SRC").map(PathBuf::from)) .unwrap_or(cwd.clone()); - let paths = matches.free[1..].iter().map(|p| { - cwd.join(p).strip_prefix(&src).expect("paths passed to be inside checkout").into() - }).collect::>(); + let paths = matches.free[1..].iter().map(|p| p.into()).collect::>(); let cfg_file = matches.opt_str("config").map(PathBuf::from).or_else(|| { if fs::metadata("config.toml").is_ok() { @@ -380,9 +378,7 @@ Arguments: cmd, incremental: matches.opt_present("incremental"), exclude: split(matches.opt_strs("exclude")) - .into_iter().map(|p| { - cwd.join(p).strip_prefix(&src).expect("paths to be inside checkout").into() - }).collect::>(), + .into_iter().map(|p| p.into()).collect::>(), src, } } From c788433b15a81935abcb84e9644d04422bf84a48 Mon Sep 17 00:00:00 2001 From: kennytm Date: Fri, 16 Feb 2018 14:27:45 +0800 Subject: [PATCH 3/3] Fix panic when `x.py` is called without any arguments. --- src/bootstrap/builder.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 7345b284dc70a..66a1c97246200 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -385,8 +385,10 @@ impl<'a> Builder<'a> { Subcommand::Clean { .. } => panic!(), }; - if paths[0] == Path::new("nonexistent/path/to/trigger/cargo/metadata") { - return; + if let Some(path) = paths.get(0) { + if path == Path::new("nonexistent/path/to/trigger/cargo/metadata") { + return; + } } let builder = Builder {