Skip to content

Commit 366a656

Browse files
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.
1 parent e78ecd2 commit 366a656

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/bootstrap/builder.rs

+4
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,10 @@ impl<'a> Builder<'a> {
385385
Subcommand::Clean { .. } => panic!(),
386386
};
387387

388+
if paths[0] == Path::new("nonexistent/path/to/trigger/cargo/metadata") {
389+
return;
390+
}
391+
388392
let builder = Builder {
389393
build,
390394
top_stage: build.config.stage.unwrap_or(2),

src/bootstrap/flags.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,7 @@ Arguments:
278278
let src = matches.opt_str("src").map(PathBuf::from)
279279
.or_else(|| env::var_os("SRC").map(PathBuf::from))
280280
.unwrap_or(cwd.clone());
281-
let paths = matches.free[1..].iter().map(|p| {
282-
cwd.join(p).strip_prefix(&src).expect("paths passed to be inside checkout").into()
283-
}).collect::<Vec<PathBuf>>();
281+
let paths = matches.free[1..].iter().map(|p| p.into()).collect::<Vec<PathBuf>>();
284282

285283
let cfg_file = matches.opt_str("config").map(PathBuf::from).or_else(|| {
286284
if fs::metadata("config.toml").is_ok() {
@@ -380,9 +378,7 @@ Arguments:
380378
cmd,
381379
incremental: matches.opt_present("incremental"),
382380
exclude: split(matches.opt_strs("exclude"))
383-
.into_iter().map(|p| {
384-
cwd.join(p).strip_prefix(&src).expect("paths to be inside checkout").into()
385-
}).collect::<Vec<_>>(),
381+
.into_iter().map(|p| p.into()).collect::<Vec<_>>(),
386382
src,
387383
}
388384
}

0 commit comments

Comments
 (0)