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 β€” assert V0 = V1. claiming they're the same.
  • --geq β€” assert V0 >= V1. V0 is greater than or equal to V1.
  • --gt β€” assert V0 > V1. strictly greater, no ties allowed.
  • --leq β€” assert V0 <= V1. less than or equal, we're being generous.
  • --lt β€” assert V0 < V1. strictly less. V0 is the underdog and we respect it.
  • --neq β€” assert V0 != 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 format FMT. and FMT has to be one of auto, pager, groff or plain. when it's auto, the format becomes pager or plain whenever the TERM env var is dumb or 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-effort option is set, and is expected to maximise the opam-query property 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 to always or never, sets a default value for the --color option.
  • OPAMCONFIRMLEVEL β€” see option --confirm-level. OPAMCONFIRMLEVEL has priority over OPAMYES and OPAMNO.
  • OPAMCRITERIA β€” specifies user preferences for dependency solving. the default value depends on the solver version, so use config report to know the current setting. see also option --criteria.
  • OPAMCUDFFILE β€” save the cudf graph to file-actions-explicit.dot.
  • OPAMCUDFTRIM β€” controls the filtering of unrelated packages during CUDF preprocessing.
  • OPAMCURL β€” can be used to select a given curl program. see OPAMFETCH for more options.
  • OPAMDEBUG β€” see options --debug and --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:2 or CLIENT 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-dir on update. 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 $EDITOR and $VISUAL.
  • OPAMERRLOGLEN β€” sets the number of log lines printed when a sub-process fails. 0 to print all.
  • OPAMEXTERNALSOLVER β€” see option --solver.
  • OPAMFAKE β€” see option --fake.
  • OPAMFETCH β€” specifies how to download files: either wget, curl or a custom command where variables %{url}%, %{out}%, %{retry}%, %{compress}% and %{checksum}% will be replaced. overrides the download-command value from the main config file.
  • OPAMFIXUPCRITERIA β€” same as OPAMUPGRADECRITERIA, 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 --locked and --lock-suffix options.
  • 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 --no and --confirm-level. OPAMNO is ignored if either OPAMCONFIRMLEVEL or OPAMYES is set.
  • OPAMNOAGGREGATE β€” with opam admin check, don't aggregate packages.
  • OPAMNOASPCUD β€” Deprecated. 🫠
  • OPAMNOAUTOUPGRADE β€” disables automatic internal upgrade of repositories in an earlier format to the current one, on update or init.
  • OPAMNOCHECKSUMS β€” enables option --no-checksums when 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 to false to disable CUDF preprocessing. less efficient, but might help debugging solver issue.
  • OPAMREPOSITORYTARRING β€” internally store all non-vcs repositories as tar.gz files (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-checksums when available (e.g. for opam install).
  • OPAMRETRIES β€” sets the number of tries before failing downloads.
  • OPAMREUSEBUILDDIR β€” see option --reuse-build-dir.
  • OPAMROOT β€” see option --root. this is automatically set by opam 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 (default true) β€” 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. if true, opam will continue with a warning; if false a timeout is an error. currently only the builtin-z3 backend handles this degraded case.
  • OPAMSOLVERTIMEOUT β€” change the time allowance of the solver. Default is 60.0, set to 0 for 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 from 0.0 (best solution known to the solver) to 1.0 (unoptimized solution). Default is 0.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 of always, never or auto)
  • OPAMSTRICT β€” fail on inconsistencies (file reading, switch import, etc.).
  • OPAMSWITCH β€” see option --switch. automatically set by opam env --switch=SWITCH --set-switch.
  • OPAMUNLOCKBASE β€” see install option --unlock-base.
  • OPAMUPGRADECRITERIA β€” specifies user preferences for dependency solving when performing an upgrade. overrides OPAMCRITERIA in 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 of always, never or auto). by default auto, which is determined from the locale.
  • OPAMUTF8MSGS β€” use extended UTF8 characters (camels) in opam messages. implies OPAMUTF8. this is set by default on macOS only. πŸͺ iconic honestly
  • OPAMVALIDATIONHOOK β€” 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 --yes and --confirm-level. OPAMYES has priority over OPAMNO and is ignored if OPAMCONFIRMLEVEL is set.
  • OPAMVAR_var β€” overrides the contents of the variable var when substituting %{var}% strings in opam files.
  • OPAMVAR_package_var β€” overrides the contents of the variable package:var when substituting %{package:var}% strings in opam files.

πŸ‘‘ 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 like opam 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 --strict raises 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. SIGINT was 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