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.
This commit is contained in:
Mark Simulacrum 2018-02-15 18:12:04 -07:00
parent e78ecd2e70
commit 366a65665a
2 changed files with 6 additions and 6 deletions

View file

@ -385,6 +385,10 @@ impl<'a> Builder<'a> {
Subcommand::Clean { .. } => panic!(), Subcommand::Clean { .. } => panic!(),
}; };
if paths[0] == Path::new("nonexistent/path/to/trigger/cargo/metadata") {
return;
}
let builder = Builder { let builder = Builder {
build, build,
top_stage: build.config.stage.unwrap_or(2), top_stage: build.config.stage.unwrap_or(2),

View file

@ -278,9 +278,7 @@ Arguments:
let src = matches.opt_str("src").map(PathBuf::from) let src = matches.opt_str("src").map(PathBuf::from)
.or_else(|| env::var_os("SRC").map(PathBuf::from)) .or_else(|| env::var_os("SRC").map(PathBuf::from))
.unwrap_or(cwd.clone()); .unwrap_or(cwd.clone());
let paths = matches.free[1..].iter().map(|p| { let paths = matches.free[1..].iter().map(|p| p.into()).collect::<Vec<PathBuf>>();
cwd.join(p).strip_prefix(&src).expect("paths passed to be inside checkout").into()
}).collect::<Vec<PathBuf>>();
let cfg_file = matches.opt_str("config").map(PathBuf::from).or_else(|| { let cfg_file = matches.opt_str("config").map(PathBuf::from).or_else(|| {
if fs::metadata("config.toml").is_ok() { if fs::metadata("config.toml").is_ok() {
@ -380,9 +378,7 @@ Arguments:
cmd, cmd,
incremental: matches.opt_present("incremental"), incremental: matches.opt_present("incremental"),
exclude: split(matches.opt_strs("exclude")) exclude: split(matches.opt_strs("exclude"))
.into_iter().map(|p| { .into_iter().map(|p| p.into()).collect::<Vec<_>>(),
cwd.join(p).strip_prefix(&src).expect("paths to be inside checkout").into()
}).collect::<Vec<_>>(),
src, src,
} }
} }