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

Migrate to clap 4.5 #136

Open
wants to merge 2 commits into
base: canon
Choose a base branch
from
Open

Conversation

just1602
Copy link

@just1602 just1602 commented Aug 21, 2024

Hello,

This PR replace structopt with the latest clap version. For now it's building and all the test are passing using cargo build and cargo test, but when I try to run nix-build the clap_lex crate fail to build with the following error:

error: builder for '/nix/store/dpqi499fkpb0iz3rbckvci7nrh1f6vdc-rust_clap_lex-0.7.2.drv' failed with exit code 1;
       last 25 log lines:
       >     |
       > 235 |                 OsStr::from_encoded_bytes_unchecked(second),
       >     |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `OsStr`
       >
       > error[E0599]: no method named `as_encoded_bytes` found for reference `&OsStr` in the current scope
       >    --> src/ext.rs:277:24
       >     |
       > 277 |         let bytes = os.as_encoded_bytes();
       >     |                        ^^^^^^^^^^^^^^^^ method not found in `&OsStr`
       >
       > error[E0599]: no function or associated item named `from_encoded_bytes_unchecked` found for struct `OsStr` in the current scope
       >    --> src/ext.rs:280:20
       >     |
       > 280 |             OsStr::from_encoded_bytes_unchecked(first),
       >     |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `OsStr`
       >
       > error[E0599]: no function or associated item named `from_encoded_bytes_unchecked` found for struct `OsStr` in the current scope
       >    --> src/ext.rs:281:20
       >     |
       > 281 |             OsStr::from_encoded_bytes_unchecked(second),
       >     |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `OsStr`
       >
       > error: aborting due to 11 previous errors
       >
       > For more information about this error, try `rustc --explain E0599`.
       For full logs, run 'nix log /nix/store/dpqi499fkpb0iz3rbckvci7nrh1f6vdc-rust_clap_lex-0.7.2.drv'.
error: 1 dependencies of derivation '/nix/store/xh0q0zr9c09k4fwf44px0c5g361xs10d-lorri.drv' failed to build

clap has a MSRV set at 1.74.0, and those functions were added in rust 1.74.0 so this should work since nixos 24.05 is using rust 1.77.2.

I think it's mainly a lack of nix experience and skill here. @nyarly if you have a couple of minutes, could you tell me if the rust version used to build this project is pinned to something older then 1.74.0, and or what would be the way to know which version of rust nix-build is using?

EDIT: I found it, nixpkgs were still pinned to 23.11. I update nix/update-nixpkgs.sh and run it. Now it builds 🎉

Fixes #105

  • Amended the changelog in release.nix (see release.nix for instructions)

@just1602 just1602 marked this pull request as ready for review August 21, 2024 18:28
@just1602 just1602 changed the title WIP: upgrade clap to 4.5 Migrate to clap 4.5 Aug 21, 2024
This commit remove `structopt`, and migrate everything to the latest
version of `clap`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate to clap v3
1 participant