diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:41 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:41 +0000 |
commit | 4f9fe856a25ab29345b90e7725509e9ee38a37be (patch) | |
tree | e4ffd8a9374cae7b21f7cbfb352927e0e074aff6 /src/tools/rust-installer | |
parent | Adding upstream version 1.68.2+dfsg1. (diff) | |
download | rustc-4f9fe856a25ab29345b90e7725509e9ee38a37be.tar.xz rustc-4f9fe856a25ab29345b90e7725509e9ee38a37be.zip |
Adding upstream version 1.69.0+dfsg1.upstream/1.69.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/tools/rust-installer/src/generator.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/tools/rust-installer/src/generator.rs b/src/tools/rust-installer/src/generator.rs index 6a4cb9b4b..1e4d00b05 100644 --- a/src/tools/rust-installer/src/generator.rs +++ b/src/tools/rust-installer/src/generator.rs @@ -3,6 +3,7 @@ use super::Tarballer; use crate::compression::CompressionFormats; use crate::util::*; use anyhow::{bail, format_err, Context, Result}; +use std::collections::BTreeSet; use std::io::Write; use std::path::Path; @@ -121,13 +122,14 @@ impl Generator { /// Copies the `src` directory recursively to `dst`, writing `manifest.in` too. fn copy_and_manifest(src: &Path, dst: &Path, bulk_dirs: &str) -> Result<()> { - let manifest = create_new_file(dst.join("manifest.in"))?; + 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 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 @@ -157,14 +159,20 @@ fn copy_and_manifest(src: &Path, dst: &Path, bulk_dirs: &str) -> Result<()> { if file_type.is_dir() { // Only manifest directories that are explicitly bulk. if bulk_dirs.contains(&path) { - writeln!(&manifest, "dir:{}", string)?; + paths.insert(format!("dir:{}\n", string)); } } else { // Only manifest files that aren't under bulk directories. if !bulk_dirs.iter().any(|d| path.starts_with(d)) { - writeln!(&manifest, "file:{}", string)?; + paths.insert(format!("file:{}\n", string)); } } Ok(()) - }) + })?; + + for path in paths { + manifest.write_all(path.as_bytes())?; + } + + Ok(()) } |