Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cp: compile without clap (for nushell) #5358

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open

Conversation

tommady
Copy link
Contributor

@tommady tommady commented Oct 5, 2023

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

@cakebaker cakebaker linked an issue Oct 5, 2023 that may be closed by this pull request
Co-authored-by: Sylvestre Ledru <sledru@mozilla.com>
@tommady tommady marked this pull request as ready for review October 5, 2023 12:13
Copy link
Member

@tertsdiepraam tertsdiepraam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! I think there's a few bits missing:

  • clap is referred to in more parts of uucore:
    • perms.rs
    • shortcut_value_parser.rs
    • backup_control.rs
    • update_control.rs
  • Because of those, the dependency isn't actually removed. Try for instance cargo check --no-default-features in the src/uu/cp folder.
  • cli-parser should be a default feature on uucore, because otherwise none of the utils will compile individually. (Try for example cargo run --no-default--features --features arch)

src/uu/date/Cargo.toml Outdated Show resolved Hide resolved
src/uu/cp/Cargo.toml Outdated Show resolved Hide resolved
@tommady
Copy link
Contributor Author

tommady commented Oct 6, 2023

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.

@tertsdiepraam
Copy link
Member

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" }

@tommady
Copy link
Contributor Author

tommady commented Oct 7, 2023

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!

src/uu/cp/Cargo.toml Outdated Show resolved Hide resolved
src/uu/cp/src/cp.rs Outdated Show resolved Hide resolved
@github-actions
Copy link

GNU testsuite comparison:

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

src/uu/cp/Cargo.toml Outdated Show resolved Hide resolved
@sylvestre
Copy link
Sponsor Contributor

@tommady sorry but it needs to be rebased

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

cp: compile without clap (for nushell)
4 participants