bootstrap: never delete the tarball temporary directory

Files in the temporary directory are used by ./x.py install.
This commit is contained in:
Pietro Albini 2020-12-30 12:10:31 +01:00
parent 8b002d5c34
commit aac429ffd3
No known key found for this signature in database
GPG Key ID: 3E06ABE80BAAF19C
2 changed files with 3 additions and 9 deletions

View File

@ -1316,8 +1316,8 @@ fn run(self, builder: &Builder<'_>) {
tarballs.push(mingw_installer.unwrap());
}
let mut tarball = Tarball::new(builder, "rust", &target.triple);
let work = tarball.persist_work_dir();
let tarball = Tarball::new(builder, "rust", &target.triple);
let work = tarball.work_dir();
tarball.combine(&tarballs);
let tmp = tmpdir(builder).join("combined-tarball");

View File

@ -97,7 +97,6 @@ pub(crate) struct Tarball<'a> {
include_target_in_component_name: bool,
is_preview: bool,
delete_temp_dir: bool,
}
impl<'a> Tarball<'a> {
@ -136,7 +135,6 @@ fn new_inner(builder: &'a Builder<'a>, component: &str, target: Option<String>)
include_target_in_component_name: false,
is_preview: false,
delete_temp_dir: true,
}
}
@ -198,8 +196,7 @@ pub(crate) fn add_dir(&self, src: impl AsRef<Path>, dest: impl AsRef<Path>) {
self.builder.cp_r(src.as_ref(), &dest);
}
pub(crate) fn persist_work_dir(&mut self) -> PathBuf {
self.delete_temp_dir = false;
pub(crate) fn work_dir(&self) -> PathBuf {
self.temp_dir.clone()
}
@ -299,9 +296,6 @@ fn run(self, build_cli: impl FnOnce(&Tarball<'a>, &mut Command)) -> PathBuf {
cmd.arg("--compression-formats").arg(formats.join(","));
}
self.builder.run(&mut cmd);
if self.delete_temp_dir {
t!(std::fs::remove_dir_all(&self.temp_dir));
}
// Use either the first compression format defined, or "gz" as the default.
let ext = self