pxar: create .pxarexclude-cli file

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller
2020-06-09 13:17:55 +02:00
parent ae66873ce9
commit 239e49f927
5 changed files with 60 additions and 21 deletions

View File

@ -821,10 +821,10 @@ async fn create_backup(
let empty = Vec::new();
let exclude_args = param["exclude"].as_array().unwrap_or(&empty);
let mut exclude_list = Vec::with_capacity(exclude_args.len());
let mut pattern_list = Vec::with_capacity(exclude_args.len());
for entry in exclude_args {
let entry = entry.as_str().ok_or_else(|| format_err!("Invalid pattern string slice"))?;
exclude_list.push(
pattern_list.push(
MatchEntry::parse_pattern(entry, PatternFlag::PATH_NAME, MatchType::Exclude)
.map_err(|err| format_err!("invalid exclude pattern entry: {}", err))?
);
@ -971,7 +971,7 @@ async fn create_backup(
skip_lost_and_found,
crypt_config.clone(),
catalog.clone(),
exclude_list.clone(),
pattern_list.clone(),
entries_max as usize,
).await?;
manifest.add_file(target, stats.size, stats.csum)?;

View File

@ -275,16 +275,16 @@ fn create_archive(
exclude: Option<Vec<String>>,
entries_max: isize,
) -> Result<(), Error> {
let exclude_list = {
let pattern_list = {
let input = exclude.unwrap_or_else(Vec::new);
let mut exclude = Vec::with_capacity(input.len());
let mut pattern_list = Vec::with_capacity(input.len());
for entry in input {
exclude.push(
pattern_list.push(
MatchEntry::parse_pattern(entry, PatternFlag::PATH_NAME, MatchType::Exclude)
.map_err(|err| format_err!("error in exclude pattern: {}", err))?,
);
}
exclude
pattern_list
};
let device_set = if all_file_systems {
@ -332,7 +332,7 @@ fn create_archive(
proxmox_backup::pxar::create_archive(
dir,
writer,
exclude_list,
pattern_list,
feature_flags,
device_set,
true,