rust-installer and rls no longer submodule, so fix rustfmt.toml
This commit is contained in:
parent
cd68ead9ec
commit
f3d9248c22
@ -16,6 +16,8 @@ ignore = [
|
||||
"tests",
|
||||
|
||||
# do not format submodules
|
||||
# FIXME: sync submodule list with tidy/bootstrap/etc
|
||||
# tidy/src/walk.rs:filter_dirs
|
||||
"library/backtrace",
|
||||
"library/portable-simd",
|
||||
"library/stdarch",
|
||||
@ -31,10 +33,8 @@ ignore = [
|
||||
"src/tools/cargo",
|
||||
"src/tools/clippy",
|
||||
"src/tools/miri",
|
||||
"src/tools/rls",
|
||||
"src/tools/rust-analyzer",
|
||||
"src/tools/rustfmt",
|
||||
"src/tools/rust-installer",
|
||||
|
||||
# these are ignored by a standard cargo fmt run
|
||||
"compiler/rustc_codegen_cranelift/y.rs", # running rustfmt breaks this file
|
||||
|
@ -71,25 +71,16 @@ pub fn run(self) -> Result<()> {
|
||||
|
||||
// Merge each installer into the work directory of the new installer.
|
||||
let components = create_new_file(package_dir.join("components"))?;
|
||||
for input_tarball in self
|
||||
.input_tarballs
|
||||
.split(',')
|
||||
.map(str::trim)
|
||||
.filter(|s| !s.is_empty())
|
||||
for input_tarball in self.input_tarballs.split(',').map(str::trim).filter(|s| !s.is_empty())
|
||||
{
|
||||
// Extract the input tarballs
|
||||
let compression =
|
||||
CompressionFormat::detect_from_path(input_tarball).ok_or_else(|| {
|
||||
anyhow::anyhow!("couldn't figure out the format of {}", input_tarball)
|
||||
})?;
|
||||
Archive::new(compression.decode(input_tarball)?)
|
||||
.unpack(&self.work_dir)
|
||||
.with_context(|| {
|
||||
format!(
|
||||
"unable to extract '{}' into '{}'",
|
||||
&input_tarball, self.work_dir
|
||||
)
|
||||
})?;
|
||||
Archive::new(compression.decode(input_tarball)?).unpack(&self.work_dir).with_context(
|
||||
|| format!("unable to extract '{}' into '{}'", &input_tarball, self.work_dir),
|
||||
)?;
|
||||
|
||||
let pkg_name =
|
||||
input_tarball.trim_end_matches(&format!(".tar.{}", compression.extension()));
|
||||
@ -126,12 +117,8 @@ pub fn run(self) -> Result<()> {
|
||||
|
||||
// Write the installer version.
|
||||
let version = package_dir.join("rust-installer-version");
|
||||
writeln!(
|
||||
create_new_file(version)?,
|
||||
"{}",
|
||||
crate::RUST_INSTALLER_VERSION
|
||||
)
|
||||
.context("failed to write new installer version")?;
|
||||
writeln!(create_new_file(version)?, "{}", crate::RUST_INSTALLER_VERSION)
|
||||
.context("failed to write new installer version")?;
|
||||
|
||||
// Copy the overlay.
|
||||
if !self.non_installed_overlay.is_empty() {
|
||||
|
@ -86,12 +86,8 @@ pub fn run(self) -> Result<()> {
|
||||
|
||||
// Write the installer version (only used by combine-installers.sh)
|
||||
let version = package_dir.join("rust-installer-version");
|
||||
writeln!(
|
||||
create_new_file(version)?,
|
||||
"{}",
|
||||
crate::RUST_INSTALLER_VERSION
|
||||
)
|
||||
.context("failed to write new installer version")?;
|
||||
writeln!(create_new_file(version)?, "{}", crate::RUST_INSTALLER_VERSION)
|
||||
.context("failed to write new installer version")?;
|
||||
|
||||
// Copy the overlay
|
||||
if !self.non_installed_overlay.is_empty() {
|
||||
@ -128,33 +124,19 @@ pub fn run(self) -> Result<()> {
|
||||
/// Copies the `src` directory recursively to `dst`, writing `manifest.in` too.
|
||||
fn copy_and_manifest(src: &Path, dst: &Path, bulk_dirs: &str) -> Result<()> {
|
||||
let mut manifest = create_new_file(dst.join("manifest.in"))?;
|
||||
let bulk_dirs: Vec<_> = bulk_dirs
|
||||
.split(',')
|
||||
.filter(|s| !s.is_empty())
|
||||
.map(Path::new)
|
||||
.collect();
|
||||
let bulk_dirs: Vec<_> = bulk_dirs.split(',').filter(|s| !s.is_empty()).map(Path::new).collect();
|
||||
|
||||
let mut paths = BTreeSet::new();
|
||||
copy_with_callback(src, dst, |path, file_type| {
|
||||
// We need paths to be compatible with both Unix and Windows.
|
||||
if path
|
||||
.components()
|
||||
.filter_map(|c| c.as_os_str().to_str())
|
||||
.any(|s| s.contains('\\'))
|
||||
{
|
||||
bail!(
|
||||
"rust-installer doesn't support '\\' in path components: {:?}",
|
||||
path
|
||||
);
|
||||
if path.components().filter_map(|c| c.as_os_str().to_str()).any(|s| s.contains('\\')) {
|
||||
bail!("rust-installer doesn't support '\\' in path components: {:?}", path);
|
||||
}
|
||||
|
||||
// Normalize to Unix-style path separators.
|
||||
let normalized_string;
|
||||
let mut string = path.to_str().ok_or_else(|| {
|
||||
format_err!(
|
||||
"rust-installer doesn't support non-Unicode paths: {:?}",
|
||||
path
|
||||
)
|
||||
format_err!("rust-installer doesn't support non-Unicode paths: {:?}", path)
|
||||
})?;
|
||||
if string.contains('\\') {
|
||||
normalized_string = string.replace('\\', "/");
|
||||
|
@ -19,8 +19,12 @@ fn main() -> Result<()> {
|
||||
let command_line = CommandLine::parse();
|
||||
match command_line.command {
|
||||
Subcommand::Combine(combiner) => combiner.run().context("failed to combine installers")?,
|
||||
Subcommand::Generate(generator) => generator.run().context("failed to generate installer")?,
|
||||
Subcommand::Script(scripter) => scripter.run().context("failed to generate installation script")?,
|
||||
Subcommand::Generate(generator) => {
|
||||
generator.run().context("failed to generate installer")?
|
||||
}
|
||||
Subcommand::Script(scripter) => {
|
||||
scripter.run().context("failed to generate installation script")?
|
||||
}
|
||||
Subcommand::Tarball(tarballer) => tarballer.run().context("failed to generate tarballs")?,
|
||||
}
|
||||
Ok(())
|
||||
|
@ -44,10 +44,7 @@ pub fn run(self) -> Result<()> {
|
||||
.replace("%%TEMPLATE_PRODUCT_NAME%%", &sh_quote(&product_name))
|
||||
.replace("%%TEMPLATE_REL_MANIFEST_DIR%%", &self.rel_manifest_dir)
|
||||
.replace("%%TEMPLATE_SUCCESS_MESSAGE%%", &sh_quote(&success_message))
|
||||
.replace(
|
||||
"%%TEMPLATE_LEGACY_MANIFEST_DIRS%%",
|
||||
&sh_quote(&self.legacy_manifest_dirs),
|
||||
)
|
||||
.replace("%%TEMPLATE_LEGACY_MANIFEST_DIRS%%", &sh_quote(&self.legacy_manifest_dirs))
|
||||
.replace(
|
||||
"%%TEMPLATE_RUST_INSTALLER_VERSION%%",
|
||||
&sh_quote(&crate::RUST_INSTALLER_VERSION),
|
||||
|
@ -58,10 +58,7 @@ pub fn run(self) -> Result<()> {
|
||||
let buf = BufWriter::with_capacity(1024 * 1024, encoder);
|
||||
let mut builder = Builder::new(buf);
|
||||
|
||||
let pool = rayon::ThreadPoolBuilder::new()
|
||||
.num_threads(2)
|
||||
.build()
|
||||
.unwrap();
|
||||
let pool = rayon::ThreadPoolBuilder::new().num_threads(2).build().unwrap();
|
||||
pool.install(move || {
|
||||
for path in dirs {
|
||||
let src = Path::new(&self.work_dir).join(&path);
|
||||
@ -122,11 +119,7 @@ fn get_recursive_paths<P, Q>(root: P, name: Q) -> Result<(Vec<String>, Vec<Strin
|
||||
let name = name.as_ref();
|
||||
|
||||
if !name.is_relative() && !name.starts_with(root) {
|
||||
bail!(
|
||||
"input '{}' is not in work dir '{}'",
|
||||
name.display(),
|
||||
root.display()
|
||||
);
|
||||
bail!("input '{}' is not in work dir '{}'", name.display(), root.display());
|
||||
}
|
||||
|
||||
let mut dirs = vec![];
|
||||
|
@ -15,8 +15,7 @@
|
||||
|
||||
/// Converts a `&Path` to a UTF-8 `&str`.
|
||||
pub fn path_to_str(path: &Path) -> Result<&str> {
|
||||
path.to_str()
|
||||
.ok_or_else(|| format_err!("path is not valid UTF-8 '{}'", path.display()))
|
||||
path.to_str().ok_or_else(|| format_err!("path is not valid UTF-8 '{}'", path.display()))
|
||||
}
|
||||
|
||||
/// Wraps `fs::copy` with a nicer error message.
|
||||
@ -27,11 +26,7 @@ pub fn copy<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> Result<u64> {
|
||||
Ok(0)
|
||||
} else {
|
||||
let amt = fs::copy(&from, &to).with_context(|| {
|
||||
format!(
|
||||
"failed to copy '{}' to '{}'",
|
||||
from.as_ref().display(),
|
||||
to.as_ref().display()
|
||||
)
|
||||
format!("failed to copy '{}' to '{}'", from.as_ref().display(), to.as_ref().display())
|
||||
})?;
|
||||
Ok(amt)
|
||||
}
|
||||
@ -123,8 +118,12 @@ pub fn copy_with_callback<F>(src: &Path, dst: &Path, mut callback: F) -> Result<
|
||||
}
|
||||
|
||||
macro_rules! actor_field_default {
|
||||
() => { Default::default() };
|
||||
(= $expr:expr) => { $expr.into() }
|
||||
() => {
|
||||
Default::default()
|
||||
};
|
||||
(= $expr:expr) => {
|
||||
$expr.into()
|
||||
};
|
||||
}
|
||||
|
||||
/// Creates an "actor" with default values, setters for all fields, and Clap parser support.
|
||||
|
Loading…
Reference in New Issue
Block a user