Skip to content

Source compatibility with newer cmdliner versions#6854

Open
WardBrian wants to merge 2 commits intoocaml:masterfrom
WardBrian:cmdliner-2-src-compat
Open

Source compatibility with newer cmdliner versions#6854
WardBrian wants to merge 2 commits intoocaml:masterfrom
WardBrian:cmdliner-2-src-compat

Conversation

@WardBrian
Copy link
Copy Markdown

Related to issues #6424, #6849, #6853

This PR makes the necessary code changes to allow compilation under cmdliner 2.0 while keeping the existing vendored version of 1.3.0.

These changes are mostly find-and-replace type things, but they would allow (at some future point):

  • Updating the vendor to 2.1.0+
  • Progressive enhancement from that point (e.g., replacing of the Arg.conv' calls this PR ads with 2.0's Arg.Conv.make, which would also allow us to specify completion handlers)

To verify, change the vendor_cmdliner.sh script to

#!/bin/sh

set -euo pipefail

cd src/core/cmdliner
rm -rf *.ml *.mli dune

git clone https://github.com/dbuenzli/cmdliner tmp-vendor
git -C tmp-vendor switch --detach v2.1.0

mv tmp-vendor/src/*.{ml,mli} .
rm -rf tmp-vendor

mv cmdliner.ml opamCmdliner.ml
mv cmdliner.mli opamCmdliner.mli

cat > dune << EOF
(library
 (name opamCmdliner)
 (public_name opam-core.cmdliner)
 (flags :standard -w -27-32-35-50))
EOF

run it, and re-build.

@kit-ty-kate kit-ty-kate added this to the 2.6.0~alpha1 milestone Jan 30, 2026
Copy link
Copy Markdown
Member

@kit-ty-kate kit-ty-kate left a comment

Choose a reason for hiding this comment

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

Thanks a lot! After some minor reformatting to avoid unrelated changes and simplify the diff it looks great.

Note for the remaining reviewer (@rjbou): the github "Hide whitespace" setting makes the diff straightforward

@kit-ty-kate kit-ty-kate requested a review from rjbou January 30, 2026 17:15
@WardBrian
Copy link
Copy Markdown
Author

Thanks!

I wasn't sure if this kind of thing needed a CHANGES entry -- should I just ignore the CI run for that, or do you have a recommendation for what section I should put it under ("Internal"?)

@kit-ty-kate
Copy link
Copy Markdown
Member

I wasn't sure if this kind of thing needed a CHANGES entry -- should I just ignore the CI run for that, or do you have a recommendation for what section I should put it under ("Internal"?)

you can ignore the CI, that's no problem, we'll do it before the last rebase/final merge. But if you want to do it before that, this one should probably go under Internal in the master_changes.md, indeed.

@WardBrian WardBrian force-pushed the cmdliner-2-src-compat branch from bdfb2ee to 306a1ee Compare April 23, 2026 15:44
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.

2 participants