Skip to content

Commit 4489ca5

Browse files
committed
mv: add selinux cfg alias
1 parent e6e3285 commit 4489ca5

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/uu/mv/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ workspace = true
1818
path = "src/mv.rs"
1919
doctest = false
2020

21+
[build-dependencies]
22+
cfg_aliases.workspace = true
23+
2124
[dependencies]
2225
clap = { workspace = true }
2326
fs_extra = { workspace = true }

src/uu/mv/build.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// This file is part of the uutils coreutils package.
2+
//
3+
// For the full copyright and license information, please view the LICENSE
4+
// file that was distributed with this source code.
5+
6+
use cfg_aliases::cfg_aliases;
7+
8+
pub fn main() {
9+
cfg_aliases! {
10+
selinux: { all(feature = "selinux", any(target_os = "android", target_os = "linux")) },
11+
}
12+
}

src/uu/mv/src/mv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use uucore::fs::{
4747
};
4848
#[cfg(all(unix, not(any(target_os = "macos", target_os = "redox"))))]
4949
use uucore::fsxattr;
50-
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
50+
#[cfg(selinux)]
5151
use uucore::selinux::set_selinux_security_context;
5252
use uucore::translate;
5353
use uucore::update_control;
@@ -771,7 +771,7 @@ fn rename(
771771
rename_with_fallback(from, to, display_manager, opts.verbose, None, None)?;
772772
}
773773

774-
#[cfg(all(feature = "selinux", any(target_os = "linux", target_os = "android")))]
774+
#[cfg(selinux)]
775775
if let Some(ref context) = opts.context {
776776
set_selinux_security_context(to, Some(context))
777777
.map_err(|e| io::Error::other(e.to_string()))?;

0 commit comments

Comments
 (0)