OPAM-ADMIN-COMPARE-VERSIONS(1)
β¨ OPAM ADMIN-COMPARE-VERSIONS(1) β¨
okay so you've wandered into the Opam admin Manual and specifically the page for opam admin compare-versions, and honestly? this one is a lil baby command with a big feelings energy. it takes two package versions and tells you which one wins. that's it. that's the whole vibe. π
πΈ SYNOPSIS πΈ
opam admin compare-versions [OPTION]β¦ V0 V1
π DESCRIPTION π
bestie. it compares 2 package versions. that's the assignment and it ate.
by default, it prints 'V0 OP V1' to the console, where OP is one of <, >, =, chosen so the equation actually holds. like, it's not gonna lie to you.
but when you supply an operator, the output gets suppressed and instead the result of the comparison is checked against the operator you gave it. in that case the command exits 0 if the comparison holds, and 1 otherwise. no notes, very clean, very demure.
for example:
$ opam admin compare-versions 0.0.9 0.0.10
0.0.9 < 0.0.10
look at that. 0.0.9 is genuinely less than 0.0.10, and the command said so out loud. slay.
$ opam admin compare-versions 0.0.9 --lt 0.0.10
[0]
we asked "is 0.0.9 < 0.0.10?" and the [0] is exit code 0, meaning yes queen, the comparison holds. π
$ opam admin compare-versions 0.0.9 --eq 0.0.10
[1]
and here we asked "are these equal?" and got [1], i.e. exit code 1, i.e. absolutely not, they are not equal, read the room. π
π¦ ARGUMENTS π¦
V0(required) β Package version to compare. one of the two little guys going head to head.V1(required) β Package version to compare. the other one. yes, both of these are required, you can't just show up with one version and expect drama.
π₯ OPTIONS π₯
one bullet per operator, one vibe per bullet:
--eqβ assertV0 = V1. claiming they're the same.--geqβ assertV0 >= V1.V0is greater than or equal toV1.--gtβ assertV0 > V1. strictly greater, no ties allowed.--leqβ assertV0 <= V1. less than or equal, we're being generous.--ltβ assertV0 < V1. strictly less.V0is the underdog and we respect it.--neqβ assertV0 != V1. they are NOT the same and we're saying it with our whole chest.
β COMMON OPTIONS β
these bad boys are common to all commands, so you'll see them everywhere, they're basically the group chat regulars.
--help[=FMT](default=auto) β shows this help in formatFMT. andFMThas to be one ofauto,pager,grofforplain. when it'sauto, the format becomespagerorplainwhenever theTERMenv var isdumbor not set at all. so if your terminal is going through it, opam adapts. considerate king.--versionβ show version information. flex the number, that's it.
π ENVIRONMENT π
opam makes use of the environment variables listed here. and listen β boolean variables should be set to "0", "no", "false" or the empty string to disable, and "1", "yes" or "true" to enable. write that down, it's gonna come up a lot.
truly a long list, so grab a snack, but we're getting through all of it because every single one matters. π
OPAMALLPARENSβ surround all filters with parenthesis.OPAMASSUMEDEPEXTSβ see option--assume-depexts.OPAMAUTOANSWERβ internal use only. don't touch, it's not for us.OPAMAUTOREMOVEβ see remove option--auto-remove.OPAMBESTEFFORTβ see option--best-effort.OPAMBESTEFFORTPREFIXCRITERIAβ sets the string that must be prepended to the criteria when the--best-effortoption is set, and is expected to maximise theopam-queryproperty in the solution.OPAMBUILDDOCβ Removed in 2.1. gone, girl, she's not coming back.OPAMBUILDTESTβ Removed in 2.1. also gone.OPAMCLIβ see option--cli.OPAMCOLORβ when set toalwaysornever, sets a default value for the--coloroption.OPAMCONFIRMLEVELβ see option--confirm-level.OPAMCONFIRMLEVELhas priority overOPAMYESandOPAMNO.OPAMCRITERIAβ specifies user preferences for dependency solving. the default value depends on the solver version, so useconfig reportto know the current setting. see also option--criteria.OPAMCUDFFILEβ save the cudf graph tofile-actions-explicit.dot.OPAMCUDFTRIMβ controls the filtering of unrelated packages during CUDF preprocessing.OPAMCURLβ can be used to select a givencurlprogram. seeOPAMFETCHfor more options.OPAMDEBUGβ see options--debugand--debug-level.OPAMDEBUGSECTIONSβ if set, limits debug messages to the space-separated list of sections. sections can optionally have a specific debug level (for example,CLIENT:2orCLIENT CUDF:2), but otherwise use--debug-level.OPAMDIGDEPTHβ defines how aggressive the lookup for conflicts during CUDF preprocessing is.OPAMDOWNLOADJOBSβ sets the maximum number of simultaneous downloads.OPAMDROPWORKINGDIRβ overrides packages previously updated with--working-dironupdate. without this variable set, opam would keep them unchanged unless explicitly named on the command-line.OPAMDRYRUNβ see option--dry-run.OPAMEDITORβ sets the editor to use for opam file editing, overrides$EDITORand$VISUAL.OPAMERRLOGLENβ sets the number of log lines printed when a sub-process fails.0to print all.OPAMEXTERNALSOLVERβ see option--solver.OPAMFAKEβ see option--fake.OPAMFETCHβ specifies how to download files: eitherwget,curlor a custom command where variables%{url}%,%{out}%,%{retry}%,%{compress}%and%{checksum}%will be replaced. overrides thedownload-commandvalue from the main config file.OPAMFIXUPCRITERIAβ same asOPAMUPGRADECRITERIA, but specific to fixup and reinstall.OPAMIGNOREAVAILABLEβ see install option--ignore-available-on.OPAMIGNORECONSTRAINTSβ see install option--ignore-constraints-on.OPAMIGNOREPINDEPENDSβ see option--ignore-pin-depends.OPAMINPLACEBUILDβ see option--inplace-build.OPAMJOBSβ sets the maximum number of parallel workers to run.OPAMJSONβ log json output to the given file (use character%to index the files).OPAMKEEPBUILDDIRβ see install option--keep-build-dir.OPAMKEEPLOGSβ tells opam to not remove some temporary command logs and some backups. this skips some finalisers and may also help to get more reliable backtraces.OPAMLOCKEDβ combination of--lockedand--lock-suffixoptions.OPAMLOGSβ logdir sets log directory, default is a temporary directory in/tmp.OPAMMAKECMDβ set the system make command to use.OPAMMERGEOUTβ merge process outputs, stderr on stdout.OPAMNOβ answer no to any question asked, see options--noand--confirm-level.OPAMNOis ignored if eitherOPAMCONFIRMLEVELorOPAMYESis set.OPAMNOAGGREGATEβ withopam admin check, don't aggregate packages.OPAMNOASPCUDβ Deprecated. π«OPAMNOAUTOUPGRADEβ disables automatic internal upgrade of repositories in an earlier format to the current one, onupdateorinit.OPAMNOCHECKSUMSβ enables option--no-checksumswhen available.OPAMNODEPEXTSβ disables system dependencies handling, see option--no-depexts.OPAMNOENVNOTICEβ Internal.OPAMNOSELFUPGRADEβ see option--no-self-upgrade.OPAMPINKINDAUTOβ sets whether version control systems should be detected when pinning to a local path. Enabled by default since 1.3.0.OPAMPRECISETRACKINGβ fine grain tracking of directories.OPAMPREPROβ set this tofalseto disable CUDF preprocessing. less efficient, but might help debugging solver issue.OPAMREPOSITORYTARRINGβ internally store all non-vcs repositories astar.gzfiles (by default, http repositories are stored as archive). this can be much faster on filesystems that don't cope well with scanning large trees. all operation are done in-memory, no I/O for scanning the repository.OPAMREQUIRECHECKSUMSβ Enables option--require-checksumswhen available (e.g. foropam install).OPAMRETRIESβ sets the number of tries before failing downloads.OPAMREUSEBUILDDIRβ see option--reuse-build-dir.OPAMROOTβ see option--root. this is automatically set byopam env --root=DIR --set-root.OPAMROOTISOKβ don't complain when running as root.OPAMSAFEβ see option--safe.OPAMSHOWβ see option--show.OPAMSKIPUPDATEβ see option--skip-updates.OPAMSKIPVERSIONCHECKSβ bypasses some version checks. Unsafe, for compatibility testing only. β οΈOPAMSOLVERALLOWSUBOPTIMAL(defaulttrue) β allows some solvers to still return a solution when they reach timeout; while the solution remains assured to be consistent, there is no guarantee in this case that it fits the expected optimisation criteria. iftrue, opam will continue with a warning; iffalsea timeout is an error. currently only thebuiltin-z3backend handles this degraded case.OPAMSOLVERTIMEOUTβ change the time allowance of the solver. Default is60.0, set to0for unlimited. note that all solvers may not support this option.OPAMSOLVERTOLERANCEβ changes the tolerance towards the solver choosing an unoptimized solution (i.e. might pull outdated packages). typical values range from0.0(best solution known to the solver) to1.0(unoptimized solution). Default is0.0. this option is useful in case the solver can't find a solution in a reasonable time (see$OPAMSOLVERTIMEOUT). note that all solvers may not support this option.OPAMSTATSβ Removed in 2.4. rip.OPAMSTATUSLINEβ display a dynamic status line showing what's currently going on on the terminal. (one ofalways,neverorauto)OPAMSTRICTβ fail on inconsistencies (file reading, switch import, etc.).OPAMSWITCHβ see option--switch. automatically set byopam env --switch=SWITCH --set-switch.OPAMUNLOCKBASEβ see install option--unlock-base.OPAMUPGRADECRITERIAβ specifies user preferences for dependency solving when performing an upgrade. overridesOPAMCRITERIAin upgrades if both are set. see also option--criteria.OPAMUSEINTERNALSOLVERβ see option--use-internal-solver.OPAMUSEOPENSSLβ Removed in 2.2.OPAMUTF8β use UTF8 characters in output (one ofalways,neverorauto). by defaultauto, which is determined from the locale.OPAMUTF8MSGSβ use extended UTF8 characters (camels) in opam messages. impliesOPAMUTF8. this is set by default on macOS only. πͺ iconic honestlyOPAMVALIDATIONHOOKβ if set, uses the%{hook}%command to validate an opam repository update.OPAMVERBOSEβ see option--verbose.OPAMVERBOSEONβ see option--verbose-on.OPAMVERSIONLAGPOWERβ do not use. that's the whole description, bestie, do not use it. πOPAMWITHDEVSETUPβ see install option--with-dev-setup.OPAMWITHDOCβ see install option--with-doc.OPAMWITHTESTβ see install option--with-test.OPAMWORKINGDIRβ see option--working-dir.OPAMYESβ see options--yesand--confirm-level.OPAMYEShas priority overOPAMNOand is ignored ifOPAMCONFIRMLEVELis set.OPAMVAR_varβ overrides the contents of the variablevarwhen substituting%{var}%strings inopamfiles.OPAMVAR_package_varβ overrides the contents of the variablepackage:varwhen substituting%{package:var}%strings inopamfiles.
π CLI VERSION π
all scripts and programmatic invocations of opam should use --cli in order to ensure that they work seamlessly with future versions of the opam client. and honestly it's not just about scripts β blog posts or other documentation can benefit too, since it prevents information from becoming stale. it's giving future-proofing. β¨
although opam only supports roots (~/.opam/) for the current version, it does provide backwards compatibility for its command-line interface. generous.
since CLI version support was only added in opam 2.1, use OPAMCLI to select 2.0 support (because opam 2.0 will just ignore it), and --cli=2.1 for 2.1 (or later) versions β because an environment variable controlling the parsing of syntax is brittle. to this end, opam displays a warning if OPAMCLI specifies a valid version other than 2.0, and also if --cli=2.0 is specified.
β οΈ heads up: an env var controlling syntax parsing is fragile, that's not a vibe, that's why opam warns you about it.
the command-line version is selected by using the --cli option or the OPAMCLI environment variable. --cli may be specified more than once, where the last instance takes precedence. OPAMCLI is only inspected if --cli is not given.
EXIT STATUS</p> πβ¨
Okay so first, the big exception: the exec command does not play by the rules below. It returns 127 if the command was not found or couldn't be executed, and otherwise it hands you back the command's own exit value. periodt.
0β Success, or true for boolean queries. we love to see it π1β False. This one shows up when a boolean return value is expected, e.g. when running with--check, or for queries likeopam lint.2β Bad command-line arguments, or command-line arguments pointing to an invalid context (e.g. a file that doesn't follow the expected format). π5β Not found. You requested something (package, version, repository, etc.) that couldn't be found. it's just not there bestie π10β Aborted. The operation required confirmation, and you didn't give it.15β Could not acquire the locks required for the operation.20β There is no solution to the user request. This can be caused by asking to install two incompatible packages, for example.30β Error in package definition, or other metadata files. Using--strictraises this error more often.31β Package script error. Some package operations were unsuccessful. This may be an error in the packages or an incompatibility with your system. This can be a partial error.40β Sync error. Could not fetch some remotes from the network. Also can be a partial error.50β Configuration error. Opam or system configuration doesn't allow the operation, and needs fixing.60β Solver failure. The solver failed to return a sound answer. It can be due to a broken external solver, or an error in solver configuration.99β Internal error. Something went wrong, likely due to a bug in opam itself. π130β User interrupt.SIGINTwas received, generally due to the user pressing Ctrl+C.
And then there's this other little set of codes, bestie β same energy, different list:
0β on success.123β on indiscriminate errors reported on standard error.124β on command line parsing errors.125β on unexpected internal errors (bugs).
FURTHER DOCUMENTATION πβ¨
See https://opam.ocaml.org/doc.
Go read it. it's giving knowledge fr fr.
AUTHORS ππ
The icons who made all of this happen, no cap:
- David Allsopp <david@tarides.com>
- Vincent Bernardoff <vb@luminar.eu.org>
- Raja Boujbel <raja.boujbel@ocamlpro.com>
- Kate Deplaix <kit-ty-kate@exn.st>
- Roberto Di Cosmo <roberto@dicosmo.org>
- Thomas Gazagnaire <thomas@gazagnaire.org>
- Louis Gesbert <louis.gesbert@ocamlpro.com>
- Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
- Anil Madhavapeddy <anil@recoil.org>
- Guillem Rieu <guillem.rieu@ocamlpro.com>
- Ralf Treinen <ralf.treinen@pps.jussieu.fr>
- Frederic Tuong <tuong@users.gforge.inria.fr>
absolute legends, every single one πΈ
SEE ALSO π¦
opam admin(1)
BUGS π
Check bug reports at https://github.com/ocaml/opam/issues.
found something cursed? don't suffer in silence bestie, drop it in the issue tracker π«Ά
and that's the whole page, bestie!! this guide came to you from the Opam admin manual, version 2.6.1, and you've just finished reading OPAM ADMIN-COMPARE-VERSIONS(1). go forth and compare those versions. slay π β¨π
π¦ where this page comes from
- arch rolling: opam 2.6.1-1 Β· LGPL-2.1-only
- fedora 44: opam 2.6.1-1.fc44 Β· LGPL-2.1-only WITH OCaml-LGPL-linking-exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms