From b41ff2ed7f918d2e5bb1e922db101704bcd03eab Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Fri, 1 Sep 2023 16:08:07 +0200 Subject: [PATCH] uucore: turn backup_control into a feature --- src/uu/cp/Cargo.toml | 8 +++++++- src/uu/install/Cargo.toml | 8 +++++++- src/uu/ln/Cargo.toml | 2 +- src/uu/mv/Cargo.toml | 2 +- src/uucore/Cargo.toml | 1 + src/uucore/src/lib/features.rs | 2 ++ src/uucore/src/lib/{mods => features}/backup_control.rs | 0 src/uucore/src/lib/lib.rs | 3 ++- src/uucore/src/lib/mods.rs | 1 - 9 files changed, 21 insertions(+), 6 deletions(-) rename src/uucore/src/lib/{mods => features}/backup_control.rs (100%) diff --git a/src/uu/cp/Cargo.toml b/src/uu/cp/Cargo.toml index c768bde0c3b..5b5c9c0d1de 100644 --- a/src/uu/cp/Cargo.toml +++ b/src/uu/cp/Cargo.toml @@ -24,7 +24,13 @@ filetime = { workspace = true } libc = { workspace = true } quick-error = { workspace = true } selinux = { workspace = true, optional = true } -uucore = { workspace = true, features = ["entries", "fs", "perms", "mode"] } +uucore = { workspace = true, features = [ + "backup-control", + "entries", + "fs", + "perms", + "mode", +] } walkdir = { workspace = true } indicatif = { workspace = true } diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index 8228e0d2028..f24c7c40d70 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -19,7 +19,13 @@ clap = { workspace = true } filetime = { workspace = true } file_diff = { workspace = true } libc = { workspace = true } -uucore = { workspace = true, features = ["fs", "mode", "perms", "entries"] } +uucore = { workspace = true, features = [ + "backup-control", + "fs", + "mode", + "perms", + "entries", +] } [[bin]] name = "install" diff --git a/src/uu/ln/Cargo.toml b/src/uu/ln/Cargo.toml index 7674129f3bc..d66338d444a 100644 --- a/src/uu/ln/Cargo.toml +++ b/src/uu/ln/Cargo.toml @@ -16,7 +16,7 @@ path = "src/ln.rs" [dependencies] clap = { workspace = true } -uucore = { workspace = true, features = ["fs"] } +uucore = { workspace = true, features = ["backup-control", "fs"] } [[bin]] name = "ln" diff --git a/src/uu/mv/Cargo.toml b/src/uu/mv/Cargo.toml index ab90e45090d..970707853d9 100644 --- a/src/uu/mv/Cargo.toml +++ b/src/uu/mv/Cargo.toml @@ -18,7 +18,7 @@ path = "src/mv.rs" clap = { workspace = true } fs_extra = { workspace = true } indicatif = { workspace = true } -uucore = { workspace = true, features = ["fs"] } +uucore = { workspace = true, features = ["backup-control", "fs"] } [[bin]] name = "mv" diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 82359108416..6b3c87b5295 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -71,6 +71,7 @@ windows-sys = { workspace = true, optional = true, default-features = false, fea [features] default = [] # * non-default features +backup-control = [] encoding = ["data-encoding", "data-encoding-macro", "z85", "thiserror"] entries = ["libc"] fs = ["libc", "winapi-util", "windows-sys"] diff --git a/src/uucore/src/lib/features.rs b/src/uucore/src/lib/features.rs index 8abccee2628..0a23b9dd968 100644 --- a/src/uucore/src/lib/features.rs +++ b/src/uucore/src/lib/features.rs @@ -4,6 +4,8 @@ // file that was distributed with this source code. // features ~ feature-gated modules (core/bundler file) +#[cfg(feature = "backup-control")] +pub mod backup_control; #[cfg(feature = "encoding")] pub mod encoding; #[cfg(feature = "fs")] diff --git a/src/uucore/src/lib/mods/backup_control.rs b/src/uucore/src/lib/features/backup_control.rs similarity index 100% rename from src/uucore/src/lib/mods/backup_control.rs rename to src/uucore/src/lib/features/backup_control.rs diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index 49505438ff7..818b7bd3fc4 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -20,7 +20,6 @@ mod parser; // string parsing modules pub use uucore_procs::*; // * cross-platform modules -pub use crate::mods::backup_control; pub use crate::mods::display; pub use crate::mods::error; pub use crate::mods::line_ending; @@ -38,6 +37,8 @@ pub use crate::parser::parse_time; pub use crate::parser::shortcut_value_parser; // * feature-gated modules +#[cfg(feature = "backup-control")] +pub use crate::features::backup_control; #[cfg(feature = "encoding")] pub use crate::features::encoding; #[cfg(feature = "fs")] diff --git a/src/uucore/src/lib/mods.rs b/src/uucore/src/lib/mods.rs index cb66c004116..6dd49438f64 100644 --- a/src/uucore/src/lib/mods.rs +++ b/src/uucore/src/lib/mods.rs @@ -4,7 +4,6 @@ // file that was distributed with this source code. // mods ~ cross-platforms modules (core/bundler file) -pub mod backup_control; pub mod display; pub mod error; pub mod line_ending;