From 1bec755b508c9c02e8888eea94b4a0e618d49182 Mon Sep 17 00:00:00 2001 From: Christian Ebner Date: Mon, 27 May 2024 14:07:36 +0200 Subject: [PATCH] pxar: bin: ignore version and prelude entries in listing Do not list the pxar format version and the prelude entries in the output of pxar list, these are not regular entries. Do include them however when dumping with the debug environmet variable set. Since the prelude is arbitrary in size, only show the content size. Signed-off-by: Christian Ebner --- pxar-bin/Cargo.toml | 1 + pxar-bin/src/main.rs | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/pxar-bin/Cargo.toml b/pxar-bin/Cargo.toml index d91c03d3e..bb010ff78 100644 --- a/pxar-bin/Cargo.toml +++ b/pxar-bin/Cargo.toml @@ -20,6 +20,7 @@ pathpatterns.workspace = true pxar.workspace = true proxmox-async.workspace = true +proxmox-human-byte.workspace = true proxmox-router = { workspace = true, features = ["cli", "server"] } proxmox-schema = { workspace = true, features = [ "api-macro" ] } proxmox-sys.workspace = true diff --git a/pxar-bin/src/main.rs b/pxar-bin/src/main.rs index 52bb1ca97..7ea5b114a 100644 --- a/pxar-bin/src/main.rs +++ b/pxar-bin/src/main.rs @@ -18,6 +18,7 @@ use pbs_client::pxar::{ }; use pxar::EntryKind; +use proxmox_human_byte::HumanByte; use proxmox_router::cli::*; use proxmox_schema::api; @@ -490,6 +491,14 @@ fn dump_archive(archive: String, payload_input: Option) -> Result<(), Er if log::log_enabled!(log::Level::Debug) { match entry.kind() { + EntryKind::Version(version) => { + log::debug!("pxar format version '{version:?}'"); + continue; + } + EntryKind::Prelude(prelude) => { + log::debug!("prelude of size {}", HumanByte::from(prelude.data.len())); + continue; + } EntryKind::File { payload_offset: Some(offset), size, @@ -508,7 +517,10 @@ fn dump_archive(archive: String, payload_input: Option) -> Result<(), Er log::debug!("{}", format_single_line_entry(&entry)); } else { - log::info!("{:?}", entry.path()); + match entry.kind() { + EntryKind::Version(_) | EntryKind::Prelude(_) => continue, + _ => log::info!("{:?}", entry.path()), + } } } Ok(())