MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / deterministic_tar_zst

Function deterministic_tar_zst

xtask/src/main.rs:9301–9315  ·  view source on GitHub ↗
(source_root: &Path, archive_root: &Path, output: &Path)

Source from the content-addressed store, hash-verified

9299}
9300
9301fn 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
9317fn archive_file_list(path: &Path) -> Result<Vec<String>> {
9318 let bytes = fs::read(path).with_context(|| format!("read {}", path.display()))?;

Calls 2

append_treeFunction · 0.85
finishMethod · 0.80

Tested by

no test coverage detected