coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

cp: compile without clap (for nushell)

Open tommady opened this issue 2 years ago • 6 comments

fulfill #5203

❯ cargo tree
uu_cp v0.0.21 (/home/arch/code/tommady/coreutils/src/uu/cp)
├── clap v4.4.2
│   └── clap_builder v4.4.2
│       ├── anstream v0.5.0
│       │   ├── anstyle v1.0.0
│       │   ├── anstyle-parse v0.2.0
│       │   │   └── utf8parse v0.2.1
│       │   ├── anstyle-query v1.0.0
│       │   ├── colorchoice v1.0.0
│       │   └── utf8parse v0.2.1
│       ├── anstyle v1.0.0
│       ├── clap_lex v0.5.0
│       ├── strsim v0.10.0
│       └── terminal_size v0.2.6
│           └── rustix v0.37.23
│               ├── bitflags v1.3.2
│               ├── io-lifetimes v1.0.11
│               │   └── libc v0.2.148
│               ├── libc v0.2.148
│               └── linux-raw-sys v0.3.8
├── filetime v0.2.22
│   ├── cfg-if v1.0.0
│   └── libc v0.2.148
├── indicatif v0.17.3
│   ├── console v0.15.7
│   │   ├── lazy_static v1.4.0
│   │   ├── libc v0.2.148
│   │   └── unicode-width v0.1.11
│   ├── number_prefix v0.4.0
│   ├── portable-atomic v0.3.15
│   └── unicode-width v0.1.11
├── libc v0.2.148
├── quick-error v2.0.1
├── uucore v0.0.21 (/home/arch/code/tommady/coreutils/src/uucore)
│   ├── clap v4.4.2 (*)
│   ├── dunce v1.0.4
│   ├── glob v0.3.1
│   ├── libc v0.2.148
│   ├── nix v0.27.1
│   │   ├── bitflags v2.4.0
│   │   ├── cfg-if v1.0.0
│   │   └── libc v0.2.148
│   ├── once_cell v1.18.0
│   ├── os_display v0.1.3
│   │   └── unicode-width v0.1.11
│   ├── uucore_procs v0.0.21 (proc-macro) (/home/arch/code/tommady/coreutils/src/uucore_procs)
│   │   ├── proc-macro2 v1.0.63
│   │   │   └── unicode-ident v1.0.5
│   │   ├── quote v1.0.29
│   │   │   └── proc-macro2 v1.0.63 (*)
│   │   └── uuhelp_parser v0.0.21 (/home/arch/code/tommady/coreutils/src/uuhelp_parser)
│   ├── walkdir v2.4.0
│   │   └── same-file v1.0.6
│   └── wild v2.2.0
├── walkdir v2.4.0 (*)
└── xattr v1.0.1
    └── libc v0.2.148

❯ cargo tree --no-default-features
uu_cp v0.0.21 (/home/arch/code/tommady/coreutils/src/uu/cp)
├── filetime v0.2.22
│   ├── cfg-if v1.0.0
│   └── libc v0.2.148
├── indicatif v0.17.3
│   ├── console v0.15.7
│   │   ├── lazy_static v1.4.0
│   │   ├── libc v0.2.148
│   │   └── unicode-width v0.1.11
│   ├── number_prefix v0.4.0
│   ├── portable-atomic v0.3.15
│   └── unicode-width v0.1.11
├── libc v0.2.148
├── quick-error v2.0.1
├── uucore v0.0.21 (/home/arch/code/tommady/coreutils/src/uucore)
│   ├── dunce v1.0.4
│   ├── glob v0.3.1
│   ├── libc v0.2.148
│   ├── nix v0.27.1
│   │   ├── bitflags v2.4.0
│   │   ├── cfg-if v1.0.0
│   │   └── libc v0.2.148
│   ├── once_cell v1.18.0
│   ├── os_display v0.1.3
│   │   └── unicode-width v0.1.11
│   ├── uucore_procs v0.0.21 (proc-macro) (/home/arch/code/tommady/coreutils/src/uucore_procs)
│   │   ├── proc-macro2 v1.0.63
│   │   │   └── unicode-ident v1.0.5
│   │   ├── quote v1.0.29
│   │   │   └── proc-macro2 v1.0.63 (*)
│   │   └── uuhelp_parser v0.0.21 (/home/arch/code/tommady/coreutils/src/uuhelp_parser)
│   ├── walkdir v2.4.0
│   │   └── same-file v1.0.6
│   └── wild v2.2.0
├── walkdir v2.4.0 (*)
└── xattr v1.0.1
    └── libc v0.2.148

tommady avatar Oct 05 '23 10:10 tommady

Hi @tertsdiepraam I am facing a problem ( or maybe just I don't know how

as you can see in the latest commit I tried to fulfill the requirements but still when you run

❯ cargo tree --no-default-features
uu_cp v0.0.21 (/home/arch/code/tommady/coreutils/src/uu/cp)
├── filetime v0.2.22
│   ├── cfg-if v1.0.0
│   └── libc v0.2.148
├── indicatif v0.17.3
│   ├── console v0.15.7
│   │   ├── lazy_static v1.4.0
│   │   ├── libc v0.2.148
│   │   └── unicode-width v0.1.11
│   ├── number_prefix v0.4.0
│   ├── portable-atomic v0.3.15
│   └── unicode-width v0.1.11
├── libc v0.2.148
├── quick-error v2.0.1
├── uucore v0.0.21 (/home/arch/code/tommady/coreutils/src/uucore)
│   ├── clap v4.4.2
│   │   └── clap_builder v4.4.2
│   │       ├── anstream v0.5.0
│   │       │   ├── anstyle v1.0.0
│   │       │   ├── anstyle-parse v0.2.0
│   │       │   │   └── utf8parse v0.2.1
│   │       │   ├── anstyle-query v1.0.0
│   │       │   ├── colorchoice v1.0.0
│   │       │   └── utf8parse v0.2.1
│   │       ├── anstyle v1.0.0
│   │       ├── clap_lex v0.5.0
│   │       ├── strsim v0.10.0
│   │       └── terminal_size v0.2.6
│   │           └── rustix v0.37.23
│   │               ├── bitflags v1.3.2
│   │               ├── io-lifetimes v1.0.11
│   │               │   └── libc v0.2.148
│   │               ├── libc v0.2.148
│   │               └── linux-raw-sys v0.3.8
│   ├── dunce v1.0.4
│   ├── glob v0.3.1
│   ├── libc v0.2.148
│   ├── nix v0.27.1
│   │   ├── bitflags v2.4.0
│   │   ├── cfg-if v1.0.0
│   │   └── libc v0.2.148
│   ├── once_cell v1.18.0
│   ├── os_display v0.1.3
│   │   └── unicode-width v0.1.11
│   ├── uucore_procs v0.0.21 (proc-macro) (/home/arch/code/tommady/coreutils/src/uucore_procs)
│   │   ├── proc-macro2 v1.0.63
│   │   │   └── unicode-ident v1.0.5
│   │   ├── quote v1.0.29
│   │   │   └── proc-macro2 v1.0.63 (*)
│   │   └── uuhelp_parser v0.0.21 (/home/arch/code/tommady/coreutils/src/uuhelp_parser)
│   ├── walkdir v2.4.0
│   │   └── same-file v1.0.6
│   └── wild v2.2.0
├── walkdir v2.4.0 (*)
└── xattr v1.0.1
    └── libc v0.2.148

under the cp folder, the clap dep stands still.

I tried a lot of ways to remove that but if any one of these features is used then the clap dep cannot be removed...

  • "entries"
  • "fs"
  • "mode"
  • "perms"
  • "update-control"
  • "backup-control"

please guide me when you have time. thanks.

tommady avatar Oct 06 '23 06:10 tommady

I had to look around for a bit but I think this fixed it! Default features and workspaces are a bit weird together :)

diff --git a/Cargo.toml b/Cargo.toml
index e7fc2851b..2beaf7630 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -343,7 +343,7 @@ blake3 = "1.5.0"
 sm3 = "0.4.2"
 digest = "0.10.7"
 
-uucore = { version = ">=0.0.19", package = "uucore", path = "src/uucore" }
+uucore = { version = ">=0.0.19", package = "uucore", path = "src/uucore", default-features = false }
 uucore_procs = { version = ">=0.0.19", package = "uucore_procs", path = "src/uucore_procs" }
 uu_ls = { version = ">=0.0.18", path = "src/uu/ls" }
 uu_base32 = { version = ">=0.0.18", path = "src/uu/base32" }

tertsdiepraam avatar Oct 06 '23 14:10 tertsdiepraam

I had to look around for a bit but I think this fixed it! Default features and workspaces are a bit weird together :)

diff --git a/Cargo.toml b/Cargo.toml
index e7fc2851b..2beaf7630 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -343,7 +343,7 @@ blake3 = "1.5.0"
 sm3 = "0.4.2"
 digest = "0.10.7"
 
-uucore = { version = ">=0.0.19", package = "uucore", path = "src/uucore" }
+uucore = { version = ">=0.0.19", package = "uucore", path = "src/uucore", default-features = false }
 uucore_procs = { version = ">=0.0.19", package = "uucore_procs", path = "src/uucore_procs" }
 uu_ls = { version = ">=0.0.18", path = "src/uu/ls" }
 uu_base32 = { version = ">=0.0.18", path = "src/uu/base32" }

wonderful it did! thanks!

tommady avatar Oct 07 '23 04:10 tommady

GNU testsuite comparison:

GNU test failed: tests/timeout/timeout. tests/timeout/timeout is passing on 'main'. Maybe you have to rebase?

github-actions[bot] avatar Oct 16 '23 09:10 github-actions[bot]

@tommady sorry but it needs to be rebased

sylvestre avatar Dec 25 '23 12:12 sylvestre