From 7b89fbe4b95f319b4d0ee18cc89cbb99c71db0eb Mon Sep 17 00:00:00 2001 From: Alexander Weiss Date: Mon, 16 Sep 2024 20:38:14 +0200 Subject: [PATCH 1/6] fix!: use multiple options only as array in config profile --- config/full-one.toml | 18 +++++++++--------- config/full.toml | 18 +++++++++--------- src/commands.rs | 4 ++-- src/config.rs | 9 +++------ src/filtering.rs | 8 +++----- 5 files changed, 26 insertions(+), 31 deletions(-) diff --git a/config/full-one.toml b/config/full-one.toml index 58dff1dd8..ef8c456b6 100644 --- a/config/full-one.toml +++ b/config/full-one.toml @@ -11,7 +11,7 @@ # Global options: These options are used for all commands. [global] -use-profile = [] +use-profiles = [] log-level = "info" # any of "off", "error", "warn", "info", "debug", "trace"; default: "info" log-file = "/path/to/rustic.log" # Default: not set no-progress = false @@ -70,10 +70,10 @@ throttle = "10kB,10MB" # limit and burst per second; only opendal backends; Defa # Snapshot-filter options: These options apply to all commands that use snapshot filters [snapshot-filter] -filter-host = "host2" # Default: no host filter -filter-label = "label1" # Default: no label filter -filter-tags = "tag1,tag2" # Default: no tags filger -filter-paths = "path1" # Default: no paths filter +filter-host = ["host2"] # Default: [] +filter-label = ["label1"] # Default: [] +filter-tags = ["tag1,tag2"] # Default: [] +filter-paths = ["path1"] # Default: [] filter-fn = '|sn| {sn.host == "host1" || sn.description.contains("test")}' # Default: no filter function # Backup options: These options are used for all sources when calling the backup command. @@ -122,10 +122,10 @@ label = "label" # Default: not set prune = false group-by = "host,label,paths" # Can be any combination of host,label,paths,tags # The following filter options can be also defined here and then overwrite the options for the forget command -filter-host = "host2" # Default: no host filter -filter-label = "label1" # Default: no label filter -filter-tags = "tag1,tag2" # Default: no tags filger -filter-paths = "path1" # Default: no paths filter +filter-host = ["host2"] # Default: [] +filter-label = ["label1"] # Default: [] +filter-tags = ["tag1,tag2"] # Default: [] +filter-paths = ["path1"] # Default: no paths filter filter-fn = '|sn| {sn.host == "host1" || sn.description.contains("test")}' # Default: no filter function # The retention options follow. All of these are not set by default. keep-tags = "tag1" # Default: not set diff --git a/config/full.toml b/config/full.toml index f5f5cb862..08a702c71 100644 --- a/config/full.toml +++ b/config/full.toml @@ -8,7 +8,7 @@ # Global options: These options are used for all commands. [global] -use-profile = [] +use-profiles = [] log-level = "info" # any of "off", "error", "warn", "info", "debug", "trace"; default: "info" log-file = "/path/to/rustic.log" # Default: not set no-progress = false @@ -67,10 +67,10 @@ throttle = "10kB,10MB" # limit and burst per second; only opendal backends; Defa # Snapshot-filter options: These options apply to all commands that use snapshot filters [snapshot-filter] -filter-host = ["host2", "host2"] # Default: no host filter -filter-label = ["label1", "label2"] # Default: no label filter -filter-tags = ["tag1,tag2", "tag3"] # Default: no tags filger -filter-paths = ["path1", "path2,path3"] # Default: no paths filter +filter-host = ["host2", "host2"] # Default: [] +filter-label = ["label1", "label2"] # Default: [] +filter-tags = ["tag1,tag2", "tag3"] # Default: [] +filter-paths = ["path1", "path2,path3"] # Default: [] filter-fn = '|sn| {sn.host == "host1" || sn.description.contains("test")}' # Default: no filter function # Backup options: These options are used for all sources when calling the backup command. @@ -126,10 +126,10 @@ source = [ prune = false group-by = "host,label,paths" # Can be any combination of host,label,paths,tags # The following filter options can be also defined here and then overwrite the options for the forget command -filter-host = ["host2", "host2"] # Default: no host filter -filter-label = ["label1", "label2"] # Default: no label filter -filter-tags = ["tag1,tag2", "tag3"] # Default: no tags filger -filter-paths = ["path1", "path2,path3"] # Default: no paths filter +filter-host = ["host2", "host2"] # Default: [] +filter-label = ["label1", "label2"] # Default: [] +filter-tags = ["tag1,tag2", "tag3"] # Default: [] +filter-paths = ["path1", "path2,path3"] # Default: [] filter-fn = '|sn| {sn.host == "host1" || sn.description.contains("test")}' # Default: no filter function # The retention options follow. All of these are not set by default. keep-tags = ["tag1", "tag2,tag3"] # Default: not set diff --git a/src/commands.rs b/src/commands.rs index cd5e9d431..f538afb3d 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -216,10 +216,10 @@ impl Configurable for EntryPoint { let mut merge_logs = Vec::new(); // get global options from command line / env and config file - if config.global.use_profile.is_empty() { + if config.global.use_profiles.is_empty() { config.merge_profile("rustic", &mut merge_logs, Level::Info)?; } else { - for profile in &config.global.use_profile.clone() { + for profile in &config.global.use_profiles.clone() { config.merge_profile(profile, &mut merge_logs, Level::Warn)?; } } diff --git a/src/config.rs b/src/config.rs index 552224d28..7ce5f9b1f 100644 --- a/src/config.rs +++ b/src/config.rs @@ -19,7 +19,6 @@ use merge::Merge; use rustic_backend::BackendOptions; use rustic_core::RepositoryOptions; use serde::{Deserialize, Serialize}; -use serde_with::{serde_as, OneOrMany}; #[cfg(feature = "webdav")] use crate::commands::webdav::WebDavCmd; @@ -104,7 +103,7 @@ impl RusticConfig { merge_logs.push((Level::Info, format!("using config {}", path.display()))); let mut config = Self::load_toml_file(AbsPathBuf::canonicalize(path)?)?; // if "use_profile" is defined in config file, merge the referenced profiles first - for profile in &config.global.use_profile.clone() { + for profile in &config.global.use_profiles.clone() { config.merge_profile(profile, merge_logs, Level::Warn)?; } self.merge(config); @@ -125,7 +124,6 @@ impl RusticConfig { /// Global options /// /// These options are available for all commands. -#[serde_as] #[derive(Default, Debug, Parser, Clone, Deserialize, Serialize, Merge)] #[serde(default, rename_all = "kebab-case", deny_unknown_fields)] pub struct GlobalOptions { @@ -133,14 +131,13 @@ pub struct GlobalOptions { /// [default: "rustic"] #[clap( short = 'P', - long, + long = "use-profile", global = true, value_name = "PROFILE", env = "RUSTIC_USE_PROFILE" )] #[merge(strategy = merge::vec::append)] - #[serde_as(as = "OneOrMany<_>")] - pub use_profile: Vec, + pub use_profiles: Vec, /// Only show what would be done without modifying anything. Does not affect read-only commands. #[clap(long, short = 'n', global = true, env = "RUSTIC_DRY_RUN")] diff --git a/src/filtering.rs b/src/filtering.rs index 82727e836..5eb42abbe 100644 --- a/src/filtering.rs +++ b/src/filtering.rs @@ -7,7 +7,7 @@ use std::{error::Error, str::FromStr}; use cached::proc_macro::cached; use rhai::{serde::to_dynamic, Dynamic, Engine, FnPtr, AST}; use serde::{Deserialize, Serialize}; -use serde_with::{serde_as, DisplayFromStr, OneOrMany}; +use serde_with::{serde_as, DisplayFromStr}; /// A function to filter snapshots /// @@ -61,24 +61,22 @@ pub struct SnapshotFilter { /// Hostname to filter (can be specified multiple times) #[clap(long, global = true, value_name = "HOSTNAME")] #[merge(strategy=merge::vec::overwrite_empty)] - #[serde_as(as = "OneOrMany<_>")] filter_host: Vec, /// Label to filter (can be specified multiple times) #[clap(long, global = true, value_name = "LABEL")] #[merge(strategy=merge::vec::overwrite_empty)] - #[serde_as(as = "OneOrMany<_>")] filter_label: Vec, /// Path list to filter (can be specified multiple times) #[clap(long, global = true, value_name = "PATH[,PATH,..]")] - #[serde_as(as = "OneOrMany")] + #[serde_as(as = "Vec")] #[merge(strategy=merge::vec::overwrite_empty)] filter_paths: Vec, /// Tag list to filter (can be specified multiple times) #[clap(long, global = true, value_name = "TAG[,TAG,..]")] - #[serde_as(as = "OneOrMany")] + #[serde_as(as = "Vec")] #[merge(strategy=merge::vec::overwrite_empty)] filter_tags: Vec, From e642c307dc1ff13823ab26f20790e8f27e0556d4 Mon Sep 17 00:00:00 2001 From: Alexander Weiss Date: Tue, 17 Sep 2024 16:33:30 +0200 Subject: [PATCH 2/6] fix config files --- config/full-one.toml | 174 ----------------------- config/full.toml | 8 +- config/local.toml | 12 +- config/rustic.toml | 8 +- config/services/rclone_ovh-hot-cold.toml | 12 +- src/commands/backup.rs | 50 +++---- tests/show-config-fixtures/empty.txt | 4 +- 7 files changed, 48 insertions(+), 220 deletions(-) delete mode 100644 config/full-one.toml diff --git a/config/full-one.toml b/config/full-one.toml deleted file mode 100644 index ef8c456b6..000000000 --- a/config/full-one.toml +++ /dev/null @@ -1,174 +0,0 @@ -# Full rustic config file containing all options which are available through the config file. -# -# It uses short notations for options which allow multiple entries in an array but are also possible as single line -# For notations using arrays, see full.toml -# -# This file should be placed in the user's local config dir (~/.config/rustic/) or in the global -# config dir (/etc/rustic). -# If you save it under NAME.toml, use "rustic -P NAME" to access this profile. -# -# Note that most options can be overwritten by the corresponding command line option. - -# Global options: These options are used for all commands. -[global] -use-profiles = [] -log-level = "info" # any of "off", "error", "warn", "info", "debug", "trace"; default: "info" -log-file = "/path/to/rustic.log" # Default: not set -no-progress = false -progress-interval = "100ms" -dry-run = false -check-index = false - -# Global env variables: These are set by rustic before calling a subcommand, e.g. rclone or commands -# defined in the repository options. -[global.env] -# This is only an example how to set an rclone env variable. Default: No variables are defined. -RCLONE_XXX = "true" - -# Repository options: These options define which backend to use and which password to use. -[repository] -repository = "/repo/rustic" # Must be set -repo-hot = "/my/hot/repo" # Default: not set -# one of the three password options must be set -password = "mySecretPassword" -password-file = "/my/password.txt" -password-command = "my_command.sh" -no-cache = false -cache-dir = "/my/rustic/cachedir" # Default: Applications default cache dir, e.g. ~/.cache/rustic -# use either warm-up (warm-up by file access) or warm-up-command to specify warming up -warm-up = false -warm-up-command = "warmup.sh" # Default: not set -warm-up-wait = "10min" # Default: not set - -# Additional repository options - depending on backend. These can be only set in the config file or using env variables. -# For env variables use upper snake case and prefix with "RUSTIC_REPO_OPT_", e.g. `use-passwort = "true"` becomes -# `RUSTIC_REPO_OPT_USE_PASSWORT=true` -[repository.options] -post-create-command = "par2create -qq -n1 -r5 %file" # Only local backend; Default: not set -post-delete-command = "sh -c \"rm -f %file*.par2\"" # Only local backend; Default: not set -retry = "default" # Only rest/rclone/all opendal backends; Allowed values: "false"/"off", "default" or number of retries -timeout = "10min" # Only rest/rclone backend -rclone-command = "rclone serve restic --addr localhost:0" # Only rclone; Default: not set -use-password = "true" # Only rclone -rest-url = "http://localhost:8000" # Only rclone; Default: determine REST URL from rclone output -connections = "20" # Only opendal backends; Default: Not set -throttle = "10kB,10MB" # limit and burst per second; only opendal backends; Default: Not set -# Note that opendal backends use several service-dependent options which may be specified here, see -# https://opendal.apache.org/docs/rust/opendal/services/index.html - -# Additional repository options for the hot part - depending on backend. These can be only set in the config file or -# using env variables. -# For env variables use upper snake case and prefix with "RUSTIC_REPO_OPTHOT_" -[repository.options-hot] -# see [repository.options] - -# Additional repository options for the cold part - depending on backend. These can be only set in the config file or -# using env variables. -# For env variables use upper snake case and prefix with "RUSTIC_REPO_OPTCOLD_" -[repository.options-cold] -# see [repository.options] - -# Snapshot-filter options: These options apply to all commands that use snapshot filters -[snapshot-filter] -filter-host = ["host2"] # Default: [] -filter-label = ["label1"] # Default: [] -filter-tags = ["tag1,tag2"] # Default: [] -filter-paths = ["path1"] # Default: [] -filter-fn = '|sn| {sn.host == "host1" || sn.description.contains("test")}' # Default: no filter function - -# Backup options: These options are used for all sources when calling the backup command. -# They can be overwritten by source-specific options (see below) or command line options. -[backup] -label = "label" # Default: not set -tag = "tag1" # Default: not set -description = "my description" # Default: not set -description-from = "/path/to/description.txt" # Default: not set -delete-never = false -delete-after = "5d" # Default: not set -host = "manually_set_host" # Default: host name -group-by = "host,label,paths" # Can be any combination of host,label,paths,tags -parent = "123abc" # Default: not set -force = false -ignore-ctime = false -ignore-inode = false -stdin-filename = "stdin" # Only for stdin source -as-path = "/my/path" # Default: not set; Note: This only works if source contains of a single path. -with-atime = false -ignore-devid = false -glob = "*.txt" # Default: not set -iglob = "*.txt" # Default: not set -glob-file = "glob-file.txt" # Default: not set -iglob-file = "glob-file.txt" # Default: not set -git-ignore = false -no-require-git = false -exclude-if-present = ".nobackup" # Default: not set -custom-ignorefile = ".rusticignore" # Default: not set -one-file-system = false -exclude-larger-than = "100MB" # Default: not set -json = false -init = false -no-scan = false -quiet = false -skip-identical-parent = false - -# Backup options for specific sources - all above options are also available here and replace them for the given source -[[backup.sources]] -source = "/path/to/source1" -label = "label" # Default: not set -# .. and so on. see [backup] - -# forget options -[forget] -prune = false -group-by = "host,label,paths" # Can be any combination of host,label,paths,tags -# The following filter options can be also defined here and then overwrite the options for the forget command -filter-host = ["host2"] # Default: [] -filter-label = ["label1"] # Default: [] -filter-tags = ["tag1,tag2"] # Default: [] -filter-paths = ["path1"] # Default: no paths filter -filter-fn = '|sn| {sn.host == "host1" || sn.description.contains("test")}' # Default: no filter function -# The retention options follow. All of these are not set by default. -keep-tags = "tag1" # Default: not set -keep-ids = "123abc" # Keep all snapshots whose ID starts with any of these strings, default: not set -keep-last = 0 -keep-daily = 3 -keep-weekly = 0 -keep-monthly = 0 -keep-quarter-yearly = 0 -keep-half-yearly = 0 -keep-yearly = 10 -keep-within = "0s" -keep-within-daily = "0 seconds" -keep-within-weekly = "2 months" -keep-withing-monthly = "1 year" -keep-withing-quarter-yearly = "0 year" -keep-withing-half-yearly = "1 year" -keep-within-yearly = "10 years" - -# Multiple targets are available for the copy command. Each specify a repository with exactly identical options as in -# the [repository] section. -[[copy.targets]] -repository = "/repo/rustic" # Must be set -repo-hot = "/my/hot/repo" # Default: not set -# one of the three password options must be set -password = "mySecretPassword" -password-file = "/my/password.txt" -password-command = "my_command.sh" -no-cache = false -cache-dir = "/my/rustic/cachedir" # Default: Applications default cache dir, e.g. ~/.cache/rustic -# use either warm-up (warm-up by file access) or warm-up-command to specify warming up -warm-up = false -warm-up-command = "warmup.sh %id" # Default: not set -warm-up-wait = "10min" # Default: not set - -[[copy.targets]] -repository = "/repo/rustic2" # Must be set -# ... - -[webdav] -address = "localhost:8000" -path-template = "[{hostname}]/[{label}]/{time}" # The path template to use for snapshots. {id}, {id_long}, {time}, {username}, {hostname}, {label}, {tags}, {backup_start}, {backup_end} are replaced. [default: "[{hostname}]/[{label}]/{time}"]. Only relevant if no snapshot-path is given. -time-template = "%Y-%m-%d_%H-%M-%S" # only relevant if no snapshot-path is given -symlinks = false -file-access = "read" # Default: "forbidden" for hot/cold repos, else "read" -snapshot-path = "latest:/dir" # Default: not set - if not set, generate a virtual tree with all snapshots using path-template diff --git a/config/full.toml b/config/full.toml index 08a702c71..42a2615d1 100644 --- a/config/full.toml +++ b/config/full.toml @@ -109,13 +109,13 @@ quiet = false skip-identical-parent = false # Backup options for specific sources - all above options are also available here and replace them for the given source -[[backup.sources]] -source = "/path/to/source1" +[[backup.snapshots]] +sources = ["/path/to/source1"] label = "label" # Default: not set # .. and so on. see [backup] -[[backup.sources]] -source = [ +[[backup.snapshots]] +sources = [ "/path/to/source2", "/second/path", ] # multiple local paths are given as array diff --git a/config/local.toml b/config/local.toml index 9b378e821..23f63decd 100644 --- a/config/local.toml +++ b/config/local.toml @@ -20,12 +20,12 @@ exclude-if-present = [".nobackup", "CACHEDIR.TAG"] glob-file = ["/root/rustic-local.glob"] one-file-system = true -[[backup.sources]] -source = "/home" +[[backup.snapshots]] +sources = ["/home"] git-ignore = true -[[backup.sources]] -source = "/etc" +[[backup.snapshots]] +sources = ["/etc"] -[[backup.sources]] -source = "/root" +[[backup.snapshots]] +sources = ["/root"] diff --git a/config/rustic.toml b/config/rustic.toml index 850821984..4e870ca53 100644 --- a/config/rustic.toml +++ b/config/rustic.toml @@ -29,11 +29,11 @@ git-ignore = true # # Note that if you call "rustic backup" without any source, all sources from this config # file will be processed. -[[backup.sources]] -source = "/data/dir" +[[backup.snapshots]] +sources = ["/data/dir"] -[[backup.sources]] -source = "/home" +[[backup.snapshots]] +sources = ["/home"] glob = ["!/home/*/Downloads/*"] # forget options diff --git a/config/services/rclone_ovh-hot-cold.toml b/config/services/rclone_ovh-hot-cold.toml index ee490b0d1..e5ea95621 100644 --- a/config/services/rclone_ovh-hot-cold.toml +++ b/config/services/rclone_ovh-hot-cold.toml @@ -23,12 +23,12 @@ exclude-if-present = [".nobackup", "CACHEDIR.TAG"] glob-file = ["/root/rustic-ovh.glob"] one-file-system = true -[[backup.sources]] -source = "/home" +[[backup.snapshots]] +sources = ["/home"] git-ignore = true -[[backup.sources]] -source = "/etc" +[[backup.snapshots]] +sources = ["/etc"] -[[backup.sources]] -source = "/root" +[[backup.snapshots]] +sources = ["/root"] diff --git a/src/commands/backup.rs b/src/commands/backup.rs index 464b04033..cc8c42f7d 100644 --- a/src/commands/backup.rs +++ b/src/commands/backup.rs @@ -14,7 +14,7 @@ use clap::ValueHint; use log::{debug, info, warn}; use merge::Merge; use serde::{Deserialize, Serialize}; -use serde_with::{serde_as, OneOrMany}; +use serde_with::serde_as; use rustic_core::{ BackupOptions, ConfigOptions, KeyOptions, LocalSourceFilterOptions, LocalSourceSaveOptions, @@ -100,16 +100,15 @@ pub struct BackupCmd { #[merge(skip)] config_opts: ConfigOptions, - /// Backup sources + /// Backup snapshots to generate #[clap(skip)] #[merge(strategy = merge_sources)] - sources: Vec, + snapshots: Vec, /// Backup source, used within config file #[clap(skip)] #[merge(skip)] - #[serde_as(as = "OneOrMany<_>")] - source: Vec, + sources: Vec, } /// Merge backup sources @@ -121,8 +120,8 @@ pub struct BackupCmd { /// * `left` - Vector of backup sources pub(crate) fn merge_sources(left: &mut Vec, mut right: Vec) { left.append(&mut right); - left.sort_by(|opt1, opt2| opt1.source.cmp(&opt2.source)); - left.dedup_by(|opt1, opt2| opt1.source == opt2.source); + left.sort_by(|opt1, opt2| opt1.sources.cmp(&opt2.sources)); + left.dedup_by(|opt1, opt2| opt1.sources == opt2.sources); } impl Runnable for BackupCmd { @@ -153,26 +152,26 @@ impl BackupCmd { .to_indexed_ids()?; // manually check for a "source" field, check is not done by serde, see above. - if !config.backup.source.is_empty() { + if !config.backup.sources.is_empty() { bail!("key \"source\" is not valid in the [backup] section!"); } - let config_opts = &config.backup.sources; + let snapshot_opts = &config.backup.snapshots; // manually check for a "sources" field, check is not done by serde, see above. - if config_opts.iter().any(|opt| !opt.sources.is_empty()) { + if snapshot_opts.iter().any(|opt| !opt.snapshots.is_empty()) { bail!("key \"sources\" is not valid in a [[backup.sources]] section!"); } - let config_sources: Vec<_> = config_opts + let config_snapshot_sources: Vec<_> = snapshot_opts .iter() .map(|opt| -> Result<_> { - Ok(PathList::from_iter(&opt.source) + Ok(PathList::from_iter(&opt.sources) .sanitize() .with_context(|| { format!( "error sanitizing source=\"{:?}\" in config file", - opt.source + opt.sources ) })? .merge()) @@ -186,38 +185,41 @@ impl BackupCmd { }) .collect(); - let sources = match (self.cli_sources.is_empty(), config_opts.is_empty()) { + let snapshot_sources = match (self.cli_sources.is_empty(), snapshot_opts.is_empty()) { (false, _) => { let item = PathList::from_iter(&self.cli_sources).sanitize()?; vec![item] } (true, false) => { info!("using all backup sources from config file."); - config_sources.clone() + config_snapshot_sources.clone() } (true, true) => { bail!("no backup source given."); } }; - for source in sources { + for sources in snapshot_sources { let mut opts = self.clone(); // merge Options from config file, if given - if let Some(idx) = config_sources.iter().position(|s| s == &source) { - info!("merging source={source} section from config file"); - opts.merge(config_opts[idx].clone()); + if let Some(idx) = config_snapshot_sources.iter().position(|s| s == &sources) { + info!("merging source={sources} section from config file"); + opts.merge(snapshot_opts[idx].clone()); } if let Some(path) = &opts.as_path { // as_path only works in combination with a single target - if source.len() > 1 { + if sources.len() > 1 { bail!("as-path only works with a single target!"); } // merge Options from config file using as_path, if given if let Some(path) = path.as_os_str().to_str() { - if let Some(idx) = config_opts.iter().position(|opt| opt.source == vec![path]) { + if let Some(idx) = snapshot_opts + .iter() + .position(|opt| opt.sources == vec![path]) + { info!("merging source=\"{path}\" section from config file"); - opts.merge(config_opts[idx].clone()); + opts.merge(snapshot_opts[idx].clone()); } } } @@ -233,7 +235,7 @@ impl BackupCmd { .ignore_filter_opts(opts.ignore_filter_opts) .no_scan(opts.no_scan) .dry_run(config.global.dry_run); - let snap = repo.backup(&backup_opts, &source, opts.snap_opts.to_snapshot()?)?; + let snap = repo.backup(&backup_opts, &sources, opts.snap_opts.to_snapshot()?)?; if opts.json { let mut stdout = std::io::stdout(); @@ -264,7 +266,7 @@ impl BackupCmd { println!("snapshot {} successfully saved.", snap.id); } - info!("backup of {source} done."); + info!("backup of {sources} done."); } Ok(()) diff --git a/tests/show-config-fixtures/empty.txt b/tests/show-config-fixtures/empty.txt index eacbf72e3..62ff899b0 100644 --- a/tests/show-config-fixtures/empty.txt +++ b/tests/show-config-fixtures/empty.txt @@ -1,5 +1,5 @@ [global] -use-profile = [] +use-profiles = [] dry-run = false check-index = false no-progress = false @@ -47,8 +47,8 @@ exclude-if-present = [] one-file-system = false tag = [] delete-never = false +snapshots = [] sources = [] -source = [] [copy] targets = [] From d63be41a834694c4fefeffd07144de3012a952eb Mon Sep 17 00:00:00 2001 From: Alexander Weiss Date: Sat, 21 Sep 2024 23:29:43 +0200 Subject: [PATCH 3/6] use plural for filters --- src/filtering.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/filtering.rs b/src/filtering.rs index 5eb42abbe..e2ae651f4 100644 --- a/src/filtering.rs +++ b/src/filtering.rs @@ -59,14 +59,14 @@ impl SnapshotFn { #[serde(default, rename_all = "kebab-case", deny_unknown_fields)] pub struct SnapshotFilter { /// Hostname to filter (can be specified multiple times) - #[clap(long, global = true, value_name = "HOSTNAME")] + #[clap(long = "filter-host", global = true, value_name = "HOSTNAME")] #[merge(strategy=merge::vec::overwrite_empty)] - filter_host: Vec, + filter_hosts: Vec, /// Label to filter (can be specified multiple times) - #[clap(long, global = true, value_name = "LABEL")] + #[clap(long = "filter-label", global = true, value_name = "LABEL")] #[merge(strategy=merge::vec::overwrite_empty)] - filter_label: Vec, + filter_labels: Vec, /// Path list to filter (can be specified multiple times) #[clap(long, global = true, value_name = "PATH[,PATH,..]")] @@ -118,7 +118,7 @@ impl SnapshotFilter { snapshot.paths.matches(&self.filter_paths) && snapshot.tags.matches(&self.filter_tags) - && (self.filter_host.is_empty() || self.filter_host.contains(&snapshot.hostname)) - && (self.filter_label.is_empty() || self.filter_label.contains(&snapshot.label)) + && (self.filter_hosts.is_empty() || self.filter_hosts.contains(&snapshot.hostname)) + && (self.filter_labels.is_empty() || self.filter_labels.contains(&snapshot.label)) } } From 432a34a77550b8f240c4c4a232f16523400beb5b Mon Sep 17 00:00:00 2001 From: Alexander Weiss Date: Sun, 22 Sep 2024 22:13:21 +0200 Subject: [PATCH 4/6] use recent rustic_core --- Cargo.lock | 210 +++++++++++++++++++++++++++++++---------------------- Cargo.toml | 4 +- 2 files changed, 126 insertions(+), 88 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5026c5ded..6641af10d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -193,9 +193,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.87" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f00e1f6e58a40e807377c75c6a7f97bf9044fab57816f2414e6f5f4499d7b8" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" [[package]] name = "arc-swap" @@ -403,13 +403,12 @@ dependencies = [ [[package]] name = "backon" -version = "0.4.4" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d67782c3f868daa71d3533538e98a8e13713231969def7536e8039606fc46bf0" +checksum = "e4fa97bb310c33c811334143cf64c5bb2b7b3c06e453db6b095d7061eff8f113" dependencies = [ "fastrand", - "futures-core", - "pin-project", + "gloo-timers", "tokio", ] @@ -550,9 +549,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.1" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" [[package]] name = "bytesize" @@ -634,9 +633,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.18" +version = "1.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476" +checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0" dependencies = [ "jobserver", "libc", @@ -688,9 +687,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.17" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" +checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3" dependencies = [ "clap_builder", "clap_derive", @@ -698,9 +697,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.17" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" +checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b" dependencies = [ "anstream", "anstyle", @@ -711,18 +710,18 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.26" +version = "4.5.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "205d5ef6d485fa47606b98b0ddc4ead26eb850aaa86abfb562a94fb3280ecba0" +checksum = "8937760c3f4c60871870b8c3ee5f9b30771f792a7045c48bcbba999d7d6b3b8e" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "4.5.13" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ "heck", "proc-macro2", @@ -792,9 +791,9 @@ dependencies = [ [[package]] name = "concurrent_arena" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c529c2d4ecc249ae15d317c9a8b9e7d86f87e80d4417de6cfa8f4d6030f37daf" +checksum = "388754cc71073ef0e6f1f72d84ac424c12c05d88eaad708c7bc55ee5dcb4e549" dependencies = [ "arc-swap", "parking_lot", @@ -2021,7 +2020,7 @@ dependencies = [ "tokio", "tokio-rustls", "tower-service", - "webpki-roots 0.26.5", + "webpki-roots 0.26.6", ] [[package]] @@ -2046,9 +2045,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.60" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -2684,9 +2683,9 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "opendal" -version = "0.49.2" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b04d09b9822c2f75a1d2fc513a2c1279c70e91e7407936fffdf6a6976ec530a" +checksum = "36e44fc43be9ffe18dad3e3ef9d61c1ae01991ee6f1c8c026978c35777a711bf" dependencies = [ "anyhow", "async-tls", @@ -2709,7 +2708,7 @@ dependencies = [ "openssh", "openssh-sftp-client", "percent-encoding", - "quick-xml 0.36.1", + "quick-xml 0.36.2", "reqsign", "reqwest", "serde", @@ -2722,9 +2721,9 @@ dependencies = [ [[package]] name = "openssh" -version = "0.10.5" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "330f4b61092456dc0aaa0cf9a205d956cae07d8127a69ffeff6760a72549c77f" +checksum = "cf397b60b682d691bf2c6125b848304ef0df2023a657aa0fc006fd6769c3d8fa" dependencies = [ "libc", "once_cell", @@ -2732,14 +2731,13 @@ dependencies = [ "tempfile", "thiserror", "tokio", - "tokio-pipe", ] [[package]] name = "openssh-sftp-client" -version = "0.14.6" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f472c9c38ea60bc161f8b5df4d04c79057003cdc12572eaad7f6dcc74e6fca5" +checksum = "7cb57886c859b298b785e20c9cbcd6681fe9106aa4fd19c0e7e8ecd801948e1e" dependencies = [ "bytes", "derive_destructure2", @@ -2758,9 +2756,9 @@ dependencies = [ [[package]] name = "openssh-sftp-client-lowlevel" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a84f1a52761901fcf5b10885544085348a872e57294531ec9188145d9a83042" +checksum = "12a5728cca10461b3842f715fb3d8acd7ef11e2635a0aff0eb5eceab2e1f1e4a" dependencies = [ "awaitable", "bytes", @@ -2775,9 +2773,9 @@ dependencies = [ [[package]] name = "openssh-sftp-error" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a5aea093d714df10186f481a6003e3f906f6fc8360c026737a841f4f182996" +checksum = "87ee6d9ea97e1fd08435222dd1eab26aa6a86674f0ff1a9583b48c98d1ef4801" dependencies = [ "awaitable-error", "openssh", @@ -3063,9 +3061,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" +checksum = "d30538d42559de6b034bc76fd6dd4c38961b1ee5c6c56e3808c50128fdbc22ce" [[package]] name = "powerfmt" @@ -3114,9 +3112,9 @@ dependencies = [ [[package]] name = "pretty_assertions" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" +checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d" dependencies = [ "diff", "yansi", @@ -3200,9 +3198,9 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.36.1" +version = "0.36.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96a05e2e8efddfa51a84ca47cec303fac86c8541b686d37cac5efc0e094417bc" +checksum = "f7649a7b4df05aed9ea7ec6f628c67c9953a43869b8bc50929569b2999d443fe" dependencies = [ "memchr", "serde", @@ -3210,9 +3208,9 @@ dependencies = [ [[package]] name = "quick_cache" -version = "0.6.6" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ec0b6fed0a0ff01fa82d0c8982389375dd59c72dae84d4f8a15b1a894c273f7" +checksum = "7d7c94f8935a9df96bb6380e8592c70edf497a643f94bd23b2f76b399385dbf4" dependencies = [ "ahash", "equivalent", @@ -3381,9 +3379,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" dependencies = [ "bitflags", ] @@ -3522,7 +3520,7 @@ dependencies = [ "wasm-bindgen-futures", "wasm-streams", "web-sys", - "webpki-roots 0.26.5", + "webpki-roots 0.26.6", "windows-registry", ] @@ -3703,7 +3701,7 @@ dependencies = [ "rhai", "rstest", "rustic_backend", - "rustic_core", + "rustic_core 0.3.1 (git+https://github.com/rustic-rs/rustic_core.git)", "rustic_testing", "scopeguard", "self_update", @@ -3723,8 +3721,7 @@ dependencies = [ [[package]] name = "rustic_backend" version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be83b3d9b405ab553d21a77a244a2979609d70b064061b7940b4835b815ab28" +source = "git+https://github.com/rustic-rs/rustic_core.git#e7edd4d030e6807511a9bd8a160763a1c3eaf3ea" dependencies = [ "aho-corasick", "anyhow", @@ -3743,10 +3740,9 @@ dependencies = [ "rand", "rayon", "reqwest", - "rustic_core", + "rustic_core 0.3.1 (git+https://github.com/rustic-rs/rustic_core.git)", "semver", "serde", - "shell-words", "strum", "strum_macros", "thiserror", @@ -3760,6 +3756,58 @@ name = "rustic_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d03fc568dbd01c9db6cb971ee93320bed6156e42dfd463b3b58869d6457a6d4" +dependencies = [ + "aes256ctr_poly1305aes", + "anyhow", + "binrw", + "bytes", + "bytesize", + "cached", + "cachedir", + "chrono", + "crossbeam-channel", + "derivative", + "derive_more", + "derive_setters", + "dirs", + "displaydoc", + "dunce", + "enum-map", + "enum-map-derive", + "enumset", + "filetime", + "gethostname", + "hex", + "humantime", + "ignore", + "integer-sqrt", + "itertools", + "log", + "nix", + "pariter", + "path-dedot", + "quick_cache", + "rand", + "rayon", + "runtime-format", + "scrypt", + "serde", + "serde-aux", + "serde_derive", + "serde_json", + "serde_with", + "sha2", + "strum", + "thiserror", + "walkdir", + "xattr", + "zstd", +] + +[[package]] +name = "rustic_core" +version = "0.3.1" +source = "git+https://github.com/rustic-rs/rustic_core.git#e7edd4d030e6807511a9bd8a160763a1c3eaf3ea" dependencies = [ "aes256ctr_poly1305aes", "anyhow", @@ -3824,15 +3872,15 @@ dependencies = [ "bytes", "enum-map", "once_cell", - "rustic_core", + "rustic_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile", ] [[package]] name = "rustix" -version = "0.38.36" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f55e80d50763938498dd5ebb18647174e0c76dc38c5505294bb224624f30f36" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ "bitflags", "errno", @@ -4036,9 +4084,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.1" +version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" +checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" dependencies = [ "core-foundation-sys", "libc", @@ -4561,18 +4609,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", @@ -4685,16 +4733,6 @@ dependencies = [ "syn 2.0.77", ] -[[package]] -name = "tokio-pipe" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f213a84bffbd61b8fa0ba8a044b4bbe35d471d0b518867181e82bd5c15542784" -dependencies = [ - "libc", - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.26.0" @@ -4763,9 +4801,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.20" +version = "0.22.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" +checksum = "3b072cee73c449a636ffd6f32bd8de3a9f7119139aff882f44943ce2986dc5cf" dependencies = [ "indexmap 2.5.0", "serde", @@ -4950,24 +4988,24 @@ checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "unicode-truncate" @@ -4982,15 +5020,15 @@ dependencies = [ [[package]] name = "unicode-width" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "unicode-xid" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] name = "universal-hash" @@ -5259,9 +5297,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.26.5" +version = "0.26.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bd24728e5af82c6c4ec1b66ac4844bdf8156257fccda846ec58b42cd0cdbe6a" +checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" dependencies = [ "rustls-pki-types", ] @@ -5521,9 +5559,9 @@ dependencies = [ [[package]] name = "yansi" -version = "0.5.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" [[package]] name = "zerocopy" diff --git a/Cargo.toml b/Cargo.toml index c63c6a85a..cd265565b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,8 +41,8 @@ rustdoc-args = ["--document-private-items", "--generate-link-to-definition"] [dependencies] abscissa_core = { version = "0.7.0", default-features = false, features = ["application"] } -rustic_backend = { version = "0.2.1", features = ["cli"] } -rustic_core = { version = "0.3.1", features = ["cli"] } +rustic_backend = { git = "https://github.com/rustic-rs/rustic_core.git", version = "0.2.1", features = ["cli"] } +rustic_core = { git = "https://github.com/rustic-rs/rustic_core.git", version = "0.3.1", features = ["cli"] } # allocators jemallocator-global = { version = "0.3.2", optional = true } From 4ea68504ccdf6c1aae60532a1883b89504eab55f Mon Sep 17 00:00:00 2001 From: Alexander Weiss Date: Sun, 22 Sep 2024 22:44:02 +0200 Subject: [PATCH 5/6] rustic_core adaptions --- config/full.toml | 22 +++++++++++----------- config/local.toml | 2 +- config/rustic.toml | 6 +++--- config/services/rclone_ovh-hot-cold.toml | 2 +- src/commands/key.rs | 4 ++-- tests/show-config-fixtures/empty.txt | 22 ++++++++++------------ 6 files changed, 28 insertions(+), 30 deletions(-) diff --git a/config/full.toml b/config/full.toml index 70e4503fc..e1530c638 100644 --- a/config/full.toml +++ b/config/full.toml @@ -34,7 +34,7 @@ no-cache = false cache-dir = "/my/rustic/cachedir" # Default: Applications default cache dir, e.g. ~/.cache/rustic # use either warm-up (warm-up by file access) or warm-up-command to specify warming up warm-up = false -warm-up-command = ["warmup.sh", "%id"] # Default: not set +warm-up-command = "warmup.sh %id" # Default: not set warm-up-wait = "10min" # Default: not set # Additional repository options - depending on backend. These can be only set in the config file or using env variables. @@ -67,8 +67,8 @@ throttle = "10kB,10MB" # limit and burst per second; only opendal backends; Defa # Snapshot-filter options: These options apply to all commands that use snapshot filters [snapshot-filter] -filter-host = ["host2", "host2"] # Default: [] -filter-label = ["label1", "label2"] # Default: [] +filter-hosts = ["host2", "host2"] # Default: [] +filter-labels = ["label1", "label2"] # Default: [] filter-tags = ["tag1,tag2", "tag3"] # Default: [] filter-paths = ["path1", "path2,path3"] # Default: [] filter-fn = '|sn| {sn.host == "host1" || sn.description.contains("test")}' # Default: no filter function @@ -77,7 +77,7 @@ filter-fn = '|sn| {sn.host == "host1" || sn.description.contains("test")}' # Def # They can be overwritten by source-specific options (see below) or command line options. [backup] label = "label" # Default: not set -tag = ["tag1", "tag2"] +tags = ["tag1", "tag2"] description = "my description" # Default: not set description-from = "/path/to/description.txt" # Default: not set delete-never = false @@ -92,14 +92,14 @@ stdin-filename = "stdin" # Only for stdin source as-path = "/my/path" # Default: not set; Note: This only works if source contains of a single path. with-atime = false ignore-devid = false -glob = [] -iglob = [] -glob-file = [] -iglob-file = [] +globs = [] +iglobs = [] +glob-files = [] +iglob-files = [] git-ignore = false no-require-git = false exclude-if-present = [".nobackup", "CACHEDIR.TAG"] # Default: not set -custom-ignorefile = [".rusticignore", ".backupignore"] # Default: not set +custom-ignorefiles = [".rusticignore", ".backupignore"] # Default: not set one-file-system = false exclude-larger-than = "100MB" # Default: not set json = false @@ -126,8 +126,8 @@ sources = [ prune = false group-by = "host,label,paths" # Can be any combination of host,label,paths,tags # The following filter options can be also defined here and then overwrite the options for the forget command -filter-host = ["host2", "host2"] # Default: [] -filter-label = ["label1", "label2"] # Default: [] +filter-hosts = ["host2", "host2"] # Default: [] +filter-labels = ["label1", "label2"] # Default: [] filter-tags = ["tag1,tag2", "tag3"] # Default: [] filter-paths = ["path1", "path2,path3"] # Default: [] filter-fn = '|sn| {sn.host == "host1" || sn.description.contains("test")}' # Default: no filter function diff --git a/config/local.toml b/config/local.toml index 23f63decd..39caa1a15 100644 --- a/config/local.toml +++ b/config/local.toml @@ -17,7 +17,7 @@ keep-yearly = 10 [backup] exclude-if-present = [".nobackup", "CACHEDIR.TAG"] -glob-file = ["/root/rustic-local.glob"] +glob-files = ["/root/rustic-local.glob"] one-file-system = true [[backup.snapshots]] diff --git a/config/rustic.toml b/config/rustic.toml index 4e870ca53..4e68f90e8 100644 --- a/config/rustic.toml +++ b/config/rustic.toml @@ -17,7 +17,7 @@ password = "mySecretPassword" # snapshot-filter options: These options apply to all commands that use snapshot filters [snapshot-filter] -filter-host = ["myhost"] +filter-hosts = ["myhost"] # backup options: These options are used for all sources when calling the backup command. # They can be overwritten by source-specific options (see below) or command line options. @@ -34,11 +34,11 @@ sources = ["/data/dir"] [[backup.snapshots]] sources = ["/home"] -glob = ["!/home/*/Downloads/*"] +globs = ["!/home/*/Downloads/*"] # forget options [forget] -filter-host = [ +filter-hosts = [ "forgethost", ] # <- this overwrites the snapshot-filter option defined above keep-tags = ["mytag"] diff --git a/config/services/rclone_ovh-hot-cold.toml b/config/services/rclone_ovh-hot-cold.toml index e5ea95621..4849f141b 100644 --- a/config/services/rclone_ovh-hot-cold.toml +++ b/config/services/rclone_ovh-hot-cold.toml @@ -20,7 +20,7 @@ keep-yearly = 10 [backup] exclude-if-present = [".nobackup", "CACHEDIR.TAG"] -glob-file = ["/root/rustic-ovh.glob"] +glob-files = ["/root/rustic-ovh.glob"] one-file-system = true [[backup.snapshots]] diff --git a/src/commands/key.rs b/src/commands/key.rs index 577242ec5..d3726c0d2 100644 --- a/src/commands/key.rs +++ b/src/commands/key.rs @@ -9,7 +9,7 @@ use anyhow::Result; use dialoguer::Password; use log::info; -use rustic_core::{KeyOptions, RepositoryOptions}; +use rustic_core::{CommandInput, KeyOptions, RepositoryOptions}; /// `key` subcommand #[derive(clap::Parser, Command, Debug)] @@ -37,7 +37,7 @@ pub(crate) struct AddCmd { /// Command to get the new password from #[clap(long)] - pub(crate) new_password_command: Vec, + pub(crate) new_password_command: Option, /// Key options #[clap(flatten)] diff --git a/tests/show-config-fixtures/empty.txt b/tests/show-config-fixtures/empty.txt index 2d70cae5e..c4aa38029 100644 --- a/tests/show-config-fixtures/empty.txt +++ b/tests/show-config-fixtures/empty.txt @@ -7,10 +7,8 @@ no-progress = false [global.env] [repository] -password-command = [] no-cache = false warm-up = false -warm-up-command = [] [repository.options] @@ -19,8 +17,8 @@ warm-up-command = [] [repository.options-cold] [snapshot-filter] -filter-host = [] -filter-label = [] +filter-hosts = [] +filter-labels = [] filter-paths = [] filter-tags = [] @@ -37,16 +35,16 @@ skip-identical-parent = false force = false ignore-ctime = false ignore-inode = false -glob = [] -iglob = [] -glob-file = [] -iglob-file = [] +globs = [] +iglobs = [] +glob-files = [] +iglob-files = [] git-ignore = false no-require-git = false -custom-ignorefile = [] +custom-ignorefiles = [] exclude-if-present = [] one-file-system = false -tag = [] +tags = [] delete-never = false snapshots = [] sources = [] @@ -56,8 +54,8 @@ targets = [] [forget] prune = false -filter-host = [] -filter-label = [] +filter-hosts = [] +filter-labels = [] filter-paths = [] filter-tags = [] From 056888939121b45f460c7f130cc28d2789966897 Mon Sep 17 00:00:00 2001 From: Alexander Weiss Date: Mon, 23 Sep 2024 15:16:54 +0200 Subject: [PATCH 6/6] use recent rustic_core --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6641af10d..2041b2024 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3029,9 +3029,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "polling" @@ -3721,7 +3721,7 @@ dependencies = [ [[package]] name = "rustic_backend" version = "0.2.1" -source = "git+https://github.com/rustic-rs/rustic_core.git#e7edd4d030e6807511a9bd8a160763a1c3eaf3ea" +source = "git+https://github.com/rustic-rs/rustic_core.git#59bd3e598988f019e79b58c6520244224835bfcb" dependencies = [ "aho-corasick", "anyhow", @@ -3807,7 +3807,7 @@ dependencies = [ [[package]] name = "rustic_core" version = "0.3.1" -source = "git+https://github.com/rustic-rs/rustic_core.git#e7edd4d030e6807511a9bd8a160763a1c3eaf3ea" +source = "git+https://github.com/rustic-rs/rustic_core.git#59bd3e598988f019e79b58c6520244224835bfcb" dependencies = [ "aes256ctr_poly1305aes", "anyhow",