(source_root: &Path, archive_root: &Path, output: &Path)
| 9299 | } |
| 9300 | |
| 9301 | fn deterministic_tar_zst(source_root: &Path, archive_root: &Path, output: &Path) -> Result<()> { |
| 9302 | if let Some(parent) = output.parent() { |
| 9303 | fs::create_dir_all(parent).with_context(|| format!("create {}", parent.display()))?; |
| 9304 | } |
| 9305 | let file = fs::File::create(output).with_context(|| format!("create {}", output.display()))?; |
| 9306 | let encoder = |
| 9307 | ZstdEncoder::new(file, 19).with_context(|| format!("create zstd {}", output.display()))?; |
| 9308 | let mut builder = tar::Builder::new(encoder); |
| 9309 | append_tree(&mut builder, source_root, source_root, archive_root)?; |
| 9310 | let encoder = builder.into_inner().context("finish tar stream")?; |
| 9311 | encoder |
| 9312 | .finish() |
| 9313 | .with_context(|| format!("finish {}", output.display()))?; |
| 9314 | Ok(()) |
| 9315 | } |
| 9316 | |
| 9317 | fn archive_file_list(path: &Path) -> Result<Vec<String>> { |
| 9318 | let bytes = fs::read(path).with_context(|| format!("read {}", path.display()))?; |
no test coverage detected