5
0
mirror of git://git.proxmox.com/git/pxar.git synced 2025-03-11 20:58:47 +03:00

ditch anyhow crate in examples/tests

mostly to shutup our current buildbot tests

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2021-05-17 11:46:50 +02:00
parent d4a04d53c9
commit 71194b54e4
4 changed files with 31 additions and 10 deletions

View File

@ -19,7 +19,6 @@ required-features = [ "async-example" ]
[[example]]
name = "pxarcmd"
path = "examples/pxarcmd.rs"
required-features = [ "anyhow" ]
[[example]]
name = "mk-format-hashes"
@ -32,7 +31,7 @@ doc = false
name = "simple"
path = "tests/simple/main.rs"
test = true
required-features = [ "anyhow", "test-harness" ]
required-features = [ "test-harness" ]
[[test]]
name = "compat"
@ -45,7 +44,6 @@ bitflags = "1.2.1"
endian_trait = { version = "0.6", features = ["arrays"] }
siphasher = "0.3"
anyhow = { version = "1.0", optional = true }
tokio = { version = "1.0", optional = true, default-features = false }
[target.'cfg(target_os = "linux")'.dependencies]
@ -59,7 +57,6 @@ tokio-fs = [ "tokio-io", "tokio/fs" ]
full = [ "tokio-fs"]
async-example = [
"anyhow",
"tokio-io",
"tokio-fs",
"tokio/rt-multi-thread",

View File

@ -5,12 +5,24 @@ use std::os::linux::fs::MetadataExt;
use std::os::unix::ffi::OsStrExt;
use std::path::{Path, PathBuf};
use anyhow::{bail, format_err, Error};
use pxar::accessor::Accessor;
use pxar::encoder::{Encoder, LinkOffset, SeqWrite};
use pxar::Metadata;
macro_rules! format_err {
($($msg:tt)+) => {
std::io::Error::new(std::io::ErrorKind::Other, format!($($msg)+))
};
}
macro_rules! bail {
($($msg:tt)+) => {{
return Err(format_err!($($msg)+).into());
}};
}
type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
fn main() -> Result<(), Error> {
let mut args = std::env::args_os();
let _ = args.next();

View File

@ -2,8 +2,6 @@ use std::collections::HashMap;
use std::io::Read;
use std::path::{Path, PathBuf};
use anyhow::{bail, format_err, Error};
use pxar::decoder::sync as decoder;
use pxar::decoder::SeqRead;
use pxar::encoder::sync as encoder;
@ -13,6 +11,8 @@ use pxar::format::{mode, Device};
use pxar::EntryKind as PxarEntryKind;
use pxar::Metadata;
use crate::Error;
/// Hardlink information we use while encoding pxar archives.
pub struct HardlinkInfo {
link: LinkOffset,

View File

@ -1,14 +1,26 @@
use std::io::Read;
use std::path::Path;
use anyhow::{bail, Error};
use pxar::accessor::sync as accessor;
use pxar::decoder::sync as decoder;
use pxar::encoder::sync as encoder;
use pxar::encoder::SeqWrite;
use pxar::EntryKind as PxarEntryKind;
macro_rules! format_err {
($($msg:tt)+) => {
std::io::Error::new(std::io::ErrorKind::Other, format!($($msg)+))
};
}
macro_rules! bail {
($($msg:tt)+) => {{
return Err(format_err!($($msg)+).into());
}};
}
pub type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
mod fs;
fn encode_directory<T: SeqWrite>(