-
Notifications
You must be signed in to change notification settings - Fork 360
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
Add an admin command to compare 2 package versions (named operators) #6197
Conversation
b992608
to
4ab0e1d
Compare
Note to myself if we end up with this version: I'd like to propose to tweak it just a bit further:
For reference, here are the operators used in opam: type relop = [`Eq|`Neq|`Geq|`Gt|`Leq|`Lt] Edit: I added all operators systematically. |
4ab0e1d
to
08995fc
Compare
@kit-ty-kate I discovered the |
Yes you're correct, i forgot to add it when i bumped the version to 2.4. You can add it by simply adding the missing |
08995fc
to
2116664
Compare
Done, Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm otherwise
Thank you @kit-ty-kate for the review and addressing these review comments! |
8d62556
to
01f61c3
Compare
I've pushed some improvement and fixes for the PR, as fixup commits. If it is ok for everyone, squash and good to go (after a rebase). |
01f61c3
to
d3096a4
Compare
@rjbou Thanks for looking into the PR! Re: Global options. My impression was that some might be applicable. Consider for example: --cli=MAJOR.MINOR (absent=2.4)
Use the command-line interface syntax and semantics of MAJOR.MINOR.
Intended for any persistent use of opam (scripts, blog posts,
etc.), any version of opam in the same MAJOR series will behave as
for the specified MINOR release. The flag was not available in opam
2.0, so to select the 2.0 CLI, set the OPAMCLI environment variable
to 2.0 instead of using this parameter. Is Re: Inlining |
that option is controlled by the user. In this particular case, the use of cli is simply to say "this option is available only since opam 2.4" and will show an error if a user says
I do agree that i personally prefer the previous version as well for the same reason. @rjbou what is the reason for changing this part of the code? |
It's a mistake in the manpage, cli option (flag and environment variable) is special, it is preprocessed. The flag should be in the
You got a point here! Ignore my last commit. |
If I understand correclty, you are saying that even though the flag doesn't show up in the --help, it is still there. I just tried this by the way: $ ./opam admin compare --cli 2.3 1.2 1.3
opam admin: compare-versions was added in version 2.4 of the opam CLI, but version 2.3 has been requested, which is older.
$ ./opam admin compare --cli 2.4 1.2 1.3
[ERROR] opam command-line version 2.4 is not supported. Is the change related to 2.4 from the PR standalone, or are there other steps required to make this work locally?
About the commits from the PR, to make sure I don't do anything unexpected:
|
d3096a4
to
60ee3f2
Compare
no no, don't worry. We are the ones who usually do that. The "squash and good to go" wasn't meant to be a directive, only a todo for Raja herself. The (auto)squash step will simply eliminate the fixup commits (aka. merge them into the previous commit). See |
huhu, i didn't see that you answered @kit-ty-kate.
There was a missing addition to have the new cli version fully functional (see new commit fixup). It worth exporting that in its own PR. if you want to do it, go for it, otherwise, will do.
The PR branch with fixup commits is a kind of opam team internal mechanism to show to others what are the changes proposed. I'll do the cleanup once we converge. |
twice xD you're too rapid for me ^^ |
I confirm! |
8a0ecd0
to
6e602a4
Compare
Sharing some thoughts |
Thanks a lot for teaching me about
I just saw your "fixup! fixup! Add cli version for 2.4". Beware, if you say "fixup!" three times in a row, who knows what may happen! 😃 I guess when you do the rebase, you can reorder these cli commit first, so you'll be able to create the PR from an intermediate commit. Thanks a lot! |
@mbarbin if you're happy with my proposed changes, I can begin the finalisation. |
4d0039c
to
6e602a4
Compare
This looks good to me. Thank you for the changes! |
6e602a4
to
c110b0e
Compare
All good! Once #6268 merged, this one will be rebased (by us), and merged! Thank you for the proposition, the (multiple) implementation proposals! |
Signed-off-by: Mathieu Barbin <[email protected]>
Signed-off-by: Mathieu Barbin <[email protected]>
c110b0e
to
8b82c7f
Compare
Thanks! |
Add a new CLI
opam admin compare-versions
to compare package versions for sanity checks.This command has 2 modes:
In this mode, we provide two versions, and opam outputs a user-friendly expression with the result of the comparison, spelled out. For example:
$ opam admin compare-versions 0.0.9 0.0.10 0.0.9 < 0.0.10
The command exits 0 regardless of the result of the comparison.
In this mode, the output is suppressed (the command is silent). The result of the command will be encoded in the exit code, to be used in bash conditionals:
exit 0: the comparison holds
exit 1: it doesn't
For example:
This PR is an alternative to #6124 with a slightly different design to avoid quoted arguments.