mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-05 14:37:37 +00:00
bootstrap: add the dist.compression-formats option
The option allows to add or remove compression formats used while producing dist tarballs.
This commit is contained in:
parent
c482ffd1a3
commit
0a2034dca4
@ -669,3 +669,7 @@ changelog-seen = 2
|
|||||||
|
|
||||||
# Whether to allow failures when building tools
|
# Whether to allow failures when building tools
|
||||||
#missing-tools = false
|
#missing-tools = false
|
||||||
|
|
||||||
|
# List of compression formats to use when generating dist tarballs. The list of
|
||||||
|
# formats is provided to rust-installer, which must support all of them.
|
||||||
|
#compression-formats = ["gz", "xz"]
|
||||||
|
@ -148,6 +148,7 @@ pub struct Config {
|
|||||||
pub dist_sign_folder: Option<PathBuf>,
|
pub dist_sign_folder: Option<PathBuf>,
|
||||||
pub dist_upload_addr: Option<String>,
|
pub dist_upload_addr: Option<String>,
|
||||||
pub dist_gpg_password_file: Option<PathBuf>,
|
pub dist_gpg_password_file: Option<PathBuf>,
|
||||||
|
pub dist_compression_formats: Option<Vec<String>>,
|
||||||
|
|
||||||
// libstd features
|
// libstd features
|
||||||
pub backtrace: bool, // support for RUST_BACKTRACE
|
pub backtrace: bool, // support for RUST_BACKTRACE
|
||||||
@ -438,6 +439,7 @@ struct Dist {
|
|||||||
upload_addr: Option<String>,
|
upload_addr: Option<String>,
|
||||||
src_tarball: Option<bool>,
|
src_tarball: Option<bool>,
|
||||||
missing_tools: Option<bool>,
|
missing_tools: Option<bool>,
|
||||||
|
compression_formats: Option<Vec<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
@ -936,6 +938,7 @@ impl Config {
|
|||||||
config.dist_sign_folder = t.sign_folder.map(PathBuf::from);
|
config.dist_sign_folder = t.sign_folder.map(PathBuf::from);
|
||||||
config.dist_gpg_password_file = t.gpg_password_file.map(PathBuf::from);
|
config.dist_gpg_password_file = t.gpg_password_file.map(PathBuf::from);
|
||||||
config.dist_upload_addr = t.upload_addr;
|
config.dist_upload_addr = t.upload_addr;
|
||||||
|
config.dist_compression_formats = t.compression_formats;
|
||||||
set(&mut config.rust_dist_src, t.src_tarball);
|
set(&mut config.rust_dist_src, t.src_tarball);
|
||||||
set(&mut config.missing_tools, t.missing_tools);
|
set(&mut config.missing_tools, t.missing_tools);
|
||||||
}
|
}
|
||||||
|
@ -147,6 +147,8 @@ v("experimental-targets", "llvm.experimental-targets",
|
|||||||
"experimental LLVM targets to build")
|
"experimental LLVM targets to build")
|
||||||
v("release-channel", "rust.channel", "the name of the release channel to build")
|
v("release-channel", "rust.channel", "the name of the release channel to build")
|
||||||
v("release-description", "rust.description", "optional descriptive string for version output")
|
v("release-description", "rust.description", "optional descriptive string for version output")
|
||||||
|
v("dist-compression-formats", None,
|
||||||
|
"comma-separated list of compression formats to use")
|
||||||
|
|
||||||
# Used on systems where "cc" is unavailable
|
# Used on systems where "cc" is unavailable
|
||||||
v("default-linker", "rust.default-linker", "the default linker")
|
v("default-linker", "rust.default-linker", "the default linker")
|
||||||
@ -349,6 +351,8 @@ for key in known_args:
|
|||||||
elif option.name == 'option-checking':
|
elif option.name == 'option-checking':
|
||||||
# this was handled above
|
# this was handled above
|
||||||
pass
|
pass
|
||||||
|
elif option.name == 'dist-compression-formats':
|
||||||
|
set('dist.compression-formats', value.split(','))
|
||||||
else:
|
else:
|
||||||
raise RuntimeError("unhandled option {}".format(option.name))
|
raise RuntimeError("unhandled option {}".format(option.name))
|
||||||
|
|
||||||
|
@ -288,11 +288,25 @@ impl<'a> Tarball<'a> {
|
|||||||
|
|
||||||
build_cli(&self, &mut cmd);
|
build_cli(&self, &mut cmd);
|
||||||
cmd.arg("--work-dir").arg(&self.temp_dir);
|
cmd.arg("--work-dir").arg(&self.temp_dir);
|
||||||
|
if let Some(formats) = &self.builder.config.dist_compression_formats {
|
||||||
|
assert!(!formats.is_empty(), "dist.compression-formats can't be empty");
|
||||||
|
cmd.arg("--compression-formats").arg(formats.join(","));
|
||||||
|
}
|
||||||
self.builder.run(&mut cmd);
|
self.builder.run(&mut cmd);
|
||||||
if self.delete_temp_dir {
|
if self.delete_temp_dir {
|
||||||
t!(std::fs::remove_dir_all(&self.temp_dir));
|
t!(std::fs::remove_dir_all(&self.temp_dir));
|
||||||
}
|
}
|
||||||
|
|
||||||
crate::dist::distdir(self.builder).join(format!("{}.tar.gz", package_name))
|
// Use either the first compression format defined, or "gz" as the default.
|
||||||
|
let ext = self
|
||||||
|
.builder
|
||||||
|
.config
|
||||||
|
.dist_compression_formats
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|formats| formats.get(0))
|
||||||
|
.map(|s| s.as_str())
|
||||||
|
.unwrap_or("gz");
|
||||||
|
|
||||||
|
crate::dist::distdir(self.builder).join(format!("{}.tar.{}", package_name, ext))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user