Add debug! logging to untar

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-06-10 16:18:01 +10:00
parent fb5f61559b
commit a681f3a156
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -22,11 +22,15 @@ fn untar(
let mut tar = Archive::new(dat); let mut tar = Archive::new(dat);
if let Some(desired_outputs) = desired_outputs { if let Some(desired_outputs) = desired_outputs {
debug!("Untaring only {desired_outputs:#?}");
for res in tar.entries()? { for res in tar.entries()? {
let mut entry = res?; let mut entry = res?;
let entry_path = entry.path()?; let entry_path = entry.path()?;
if desired_outputs.contains(&entry_path) { if desired_outputs.contains(&entry_path) {
debug!("Extracting {entry_path:#?}");
let dst = path.join(entry_path); let dst = path.join(entry_path);
fs::create_dir_all(dst.parent().unwrap())?; fs::create_dir_all(dst.parent().unwrap())?;
@ -35,6 +39,7 @@ fn untar(
} }
} }
} else { } else {
debug!("Untaring entire tar");
tar.unpack(path)?; tar.unpack(path)?;
} }