Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ numfmt = { optional = true, version = "0.13.0", package = "uu_numfmt", path = "s
od = { optional = true, version = "0.13.0", package = "uu_od", path = "src/uu/od" }
paste = { optional = true, version = "0.13.0", package = "uu_paste", path = "src/uu/paste" }
pathchk = { optional = true, version = "0.13.0", package = "uu_pathchk", path = "src/uu/pathchk" }
pinky = { optional = true, version = "0.13.0", package = "uu_pinky", path = "src/uu/pinky" }
pr = { optional = true, version = "0.13.0", package = "uu_pr", path = "src/uu/pr" }
printenv = { optional = true, version = "0.13.0", package = "uu_printenv", path = "src/uu/printenv" }
printf = { optional = true, version = "0.13.0", package = "uu_printf", path = "src/uu/printf" }
Expand Down Expand Up @@ -349,7 +348,6 @@ uptime = { optional = true, version = "0.13.0", package = "uu_uptime", path = "s
users = { optional = true, version = "0.13.0", package = "uu_users", path = "src/uu/users" }
vdir = { optional = true, version = "0.13.0", package = "uu_vdir", path = "src/uu/vdir" }
wc = { optional = true, version = "0.13.0", package = "uu_wc", path = "src/uu/wc" }
who = { optional = true, version = "0.13.0", package = "uu_who", path = "src/uu/who" }
whoami = { optional = true, version = "0.13.0", package = "uu_whoami", path = "src/uu/whoami" }
yes = { optional = true, version = "0.13.0", package = "uu_yes", path = "src/uu/yes" }

Expand Down Expand Up @@ -399,6 +397,10 @@ runcon = { optional = true, version = "0.13.0", package = "uu_runcon", path = "s
# Not needed for now. Keep as examples:
#pin_cc = { version="1.0.61, < 1.0.62", package="cc" } ## cc v1.0.62 has compiler errors for MinRustV v1.32.0, requires 1.34 (for `std::str::split_ascii_whitespace()`)

[target.'cfg(any(target_vendor = "apple", target_os = "cygwin", target_os = "freebsd", target_os = "linux", target_os = "netbsd"))'.dependencies]
pinky = { optional = true, version = "0.13.0", package = "uu_pinky", path = "src/uu/pinky" }
who = { optional = true, version = "0.13.0", package = "uu_who", path = "src/uu/who" }

[target.'cfg(unix)'.dev-dependencies]
nix = { workspace = true, features = ["fs", "signal"] }
rlimit = { workspace = true }
Expand Down
10 changes: 10 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pub fn main() {
let out_dir = env::var("OUT_DIR").unwrap();

let target_os = env::var_os("CARGO_CFG_TARGET_OS").unwrap();
let target_vendor = env::var_os("CARGO_CFG_TARGET_VENDOR").unwrap();
for (key, val) in env::vars() {
if val == "1" && key.starts_with(ENV_FEATURE_PREFIX) {
let krate = key[ENV_FEATURE_PREFIX.len()..].to_lowercase();
Expand All @@ -50,6 +51,15 @@ pub fn main() {
"chcon" | "runcon" if !(target_os == "linux" || target_os == "android") => {
continue;
}
"pinky" | "who"
if !(target_vendor == "apple"
|| target_os == "cygwin"
|| target_os == "freebsd"
|| target_os == "linux"
|| target_os == "netbsd") =>
{
continue;
}
"default" | "macos" | "unix" | "windows" | "selinux" | "zip" | "clap_complete"
| "clap_mangen" | "fluent_syntax" | "openssl" => continue, // common/standard feature names
"nightly" | "test_unimplemented" | "expensive_tests" | "test_risky_names" => {
Expand Down
3 changes: 2 additions & 1 deletion src/uu/pinky/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ readme.workspace = true
path = "src/pinky.rs"
doctest = false

[dependencies]
[target.'cfg(any(target_vendor = "apple", target_os = "cygwin", target_os = "freebsd", target_os = "linux", target_os = "netbsd"))'.dependencies]
clap = { workspace = true }
fluent = { workspace = true }
uucore = { workspace = true, features = ["utmpx", "entries"] }
Expand All @@ -31,3 +31,4 @@ workspace = true
[[bin]]
name = "pinky"
path = "src/main.rs"
required-features = ["uucore/default"]
3 changes: 0 additions & 3 deletions src/uu/pinky/locales/en-US.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,3 @@ pinky-directory-label = Directory:
pinky-shell-label = Shell:
pinky-project-label = Project:
pinky-plan-label = Plan

# Status messages
pinky-unsupported-openbsd = unsupported command on OpenBSD
3 changes: 0 additions & 3 deletions src/uu/pinky/locales/fr-FR.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,3 @@ pinky-directory-label = Répertoire :
pinky-shell-label = Shell :
pinky-project-label = Projet :
pinky-plan-label = Plan

# Messages de statut
pinky-unsupported-openbsd = commande non prise en charge sur OpenBSD
8 changes: 8 additions & 0 deletions src/uu/pinky/src/pinky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.

#![cfg(any(
target_vendor = "apple",
target_os = "cygwin",
target_os = "freebsd",
target_os = "linux",
target_os = "netbsd",
))]

use clap::{Arg, ArgAction, Command};
use uucore::format_usage;
use uucore::translate;
Expand Down
8 changes: 1 addition & 7 deletions src/uu/pinky/src/platform/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.

#[cfg(not(target_os = "openbsd"))]
mod unix;
#[cfg(not(target_os = "openbsd"))]
pub use self::unix::*;

#[cfg(target_os = "openbsd")]
mod openbsd;
#[cfg(target_os = "openbsd")]
pub use self::openbsd::*;
pub use self::unix::*;
20 changes: 0 additions & 20 deletions src/uu/pinky/src/platform/openbsd.rs

This file was deleted.

3 changes: 2 additions & 1 deletion src/uu/who/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ path = "src/who.rs"
test = false
doctest = false

[dependencies]
[target.'cfg(any(target_vendor = "apple", target_os = "cygwin", target_os = "freebsd", target_os = "linux", target_os = "netbsd"))'.dependencies]
clap = { workspace = true }
fluent = { workspace = true }
rustix = { workspace = true, features = ["fs", "termios"] }
Expand All @@ -33,3 +33,4 @@ workspace = true
[[bin]]
name = "who"
path = "src/main.rs"
required-features = ["uucore/default"]
3 changes: 0 additions & 3 deletions src/uu/who/locales/en-US.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,3 @@ who-heading-exit = EXIT

# Error messages
who-canonicalize-error = failed to canonicalize { $host }

# Platform-specific messages
who-unsupported-openbsd = unsupported command on OpenBSD
3 changes: 0 additions & 3 deletions src/uu/who/locales/fr-FR.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,3 @@ who-heading-exit = SORTIE

# Error messages
who-canonicalize-error = échec de canonicalisation de { $host }

# Platform-specific messages
who-unsupported-openbsd = commande non prise en charge sur OpenBSD
8 changes: 1 addition & 7 deletions src/uu/who/src/platform/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.

#[cfg(not(target_os = "openbsd"))]
mod unix;
Comment thread
xtqqczze marked this conversation as resolved.
Resolved
#[cfg(not(target_os = "openbsd"))]
pub use self::unix::*;

#[cfg(target_os = "openbsd")]
mod openbsd;
#[cfg(target_os = "openbsd")]
pub use self::openbsd::*;
pub use self::unix::*;
17 changes: 0 additions & 17 deletions src/uu/who/src/platform/openbsd.rs

This file was deleted.

8 changes: 8 additions & 0 deletions src/uu/who/src/who.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@

// spell-checker:ignore (ToDO) runlevel mesg

#![cfg(any(
Comment thread
xtqqczze marked this conversation as resolved.
Resolved
target_vendor = "apple",
target_os = "cygwin",
target_os = "freebsd",
target_os = "linux",
target_os = "netbsd",
))]

use clap::{Arg, ArgAction, Command};
use uucore::format_usage;
use uucore::translate;
Expand Down
19 changes: 8 additions & 11 deletions tests/by-util/test_pinky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.

#[cfg(not(target_os = "openbsd"))]
#![cfg(any(
target_vendor = "apple",
target_os = "cygwin",
target_os = "freebsd",
target_os = "linux",
target_os = "netbsd",
))]

use uucore::entries::{Locate, Passwd};
use uutests::new_ucmd;
#[cfg(not(target_os = "openbsd"))]
use uutests::util::{TestScenario, expected_result};
#[cfg(not(target_os = "openbsd"))]
use uutests::{unwrap_or_return, util_name};

#[test]
Expand All @@ -17,7 +22,6 @@ fn test_invalid_arg() {
}

#[test]
#[cfg(not(target_os = "openbsd"))]
fn test_long_format() {
use pinky::capitalize;

Expand All @@ -43,7 +47,6 @@ fn test_long_format() {

#[cfg(unix)]
#[test]
#[cfg(not(target_os = "openbsd"))]
fn test_long_format_multiple_users() {
// multiple instances of one account we know exists,
// the account of the test runner,
Expand All @@ -61,7 +64,6 @@ fn test_long_format_multiple_users() {
}

#[test]
#[cfg(not(target_os = "openbsd"))]
fn test_long_format_numeric_operand_is_not_a_uid() {
// No account is named "+0", so it must not be looked up as uid 0.
new_ucmd!()
Expand All @@ -78,7 +80,6 @@ fn test_long_format_wo_user() {

#[cfg(unix)]
#[test]
#[cfg(not(target_os = "openbsd"))]
fn test_short_format_i() {
// allow whitespace variation
// * minor whitespace differences occur between platform built-in outputs; specifically, the number of trailing TABs may be variant
Expand All @@ -98,7 +99,6 @@ fn test_short_format_i() {
/// Remove the `Idle` header and every `HH:MM`-looking token so only the stable
/// fields are compared.
#[cfg(unix)]
#[cfg(not(target_os = "openbsd"))]
fn strip_volatile_fields(fields: &[&str]) -> Vec<String> {
fn is_clock_value(s: &str) -> bool {
let bytes = s.as_bytes();
Expand All @@ -116,7 +116,6 @@ fn strip_volatile_fields(fields: &[&str]) -> Vec<String> {

#[cfg(unix)]
#[test]
#[cfg(not(target_os = "openbsd"))]
fn test_lookup() {
let args = ["--lookup"];
let ts = TestScenario::new(util_name!());
Expand All @@ -132,7 +131,6 @@ fn test_lookup() {

#[cfg(unix)]
#[test]
#[cfg(not(target_os = "openbsd"))]
fn test_short_format_q() {
// allow whitespace variation
// * minor whitespace differences occur between platform built-in outputs; specifically, the number of trailing TABs may be variant
Expand All @@ -150,7 +148,6 @@ fn test_short_format_q() {

#[cfg(unix)]
#[test]
#[cfg(not(target_os = "openbsd"))]
fn test_no_flag() {
let ts = TestScenario::new(util_name!());
let actual = ts.ucmd().succeeds().stdout_move_str();
Expand Down
16 changes: 8 additions & 8 deletions tests/by-util/test_who.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@

// spell-checker:ignore (flags) runlevel mesg

#![cfg(any(
target_vendor = "apple",
target_os = "cygwin",
target_os = "freebsd",
target_os = "linux",
target_os = "netbsd",
))]

use uutests::new_ucmd;
use uutests::unwrap_or_return;
use uutests::util::{TestScenario, expected_result, gnu_cmd_result};
Expand All @@ -27,7 +35,6 @@ fn test_count() {

#[cfg(unix)]
#[test]
#[cfg(not(target_os = "openbsd"))]
#[cfg_attr(
all(target_arch = "aarch64", target_os = "linux"),
ignore = "Issue #7174 - Test not supported on ARM64 Linux"
Expand Down Expand Up @@ -72,7 +79,6 @@ fn test_short() {

#[cfg(unix)]
#[test]
#[cfg(not(target_os = "openbsd"))]
fn test_login() {
let ts = TestScenario::new(util_name!());
for opt in ["-l", "--login", "--log"] {
Expand All @@ -83,7 +89,6 @@ fn test_login() {

#[cfg(unix)]
#[test]
#[cfg(not(target_os = "openbsd"))]
fn test_m() {
let ts = TestScenario::new(util_name!());
let expected_stdout = unwrap_or_return!(expected_result(&ts, &["-m"])).stdout_move_str();
Expand All @@ -92,7 +97,6 @@ fn test_m() {

#[cfg(unix)]
#[test]
#[cfg(not(target_os = "openbsd"))]
fn test_process() {
let ts = TestScenario::new(util_name!());
for opt in ["-p", "--process", "--p"] {
Expand All @@ -103,7 +107,6 @@ fn test_process() {

#[cfg(unix)]
#[test]
#[cfg(not(target_os = "openbsd"))]
fn test_runlevel() {
let ts = TestScenario::new(util_name!());
for opt in ["-r", "--runlevel", "--r"] {
Expand All @@ -117,7 +120,6 @@ fn test_runlevel() {

#[cfg(unix)]
#[test]
#[cfg(not(target_os = "openbsd"))]
fn test_time() {
let ts = TestScenario::new(util_name!());
for opt in ["-t", "--time", "--t"] {
Expand Down Expand Up @@ -153,7 +155,6 @@ fn test_mesg() {

#[cfg(unix)]
#[test]
#[cfg(not(target_os = "openbsd"))]
fn test_arg1_arg2() {
let args = ["am", "i"];
let ts = TestScenario::new(util_name!());
Expand Down Expand Up @@ -208,7 +209,6 @@ fn test_lookup() {

#[cfg(unix)]
#[test]
#[cfg(not(target_os = "openbsd"))]
fn test_dead() {
let ts = TestScenario::new(util_name!());
for opt in ["-d", "--dead", "--de"] {
Expand Down
Loading