OPAM-ADMIN-UPGRADE(1)

๐Ÿ’– OPAM-ADMIN-UPGRADE ๐Ÿ’–

okay bestie, welcome to the Opam admin Manual corner of the internet โœจ this is OPAM-ADMIN-UPGRADE(1) and she is THAT girl, so let's get into it ๐ŸŽ€


๐Ÿฆ‹ NAME ๐Ÿฆ‹

opam admin-upgrade โ€” upgrades your repository from earlier opam versions, no cap ๐Ÿ’…


โœจ SYNOPSIS โœจ

opam admin upgrade [--clear-cache] [--mirror=URL] [OPTION]โ€ฆ

๐ŸŒธ DESCRIPTION ๐ŸŒธ

okay so here's the vibe: this command reads repositories from earlier opam versions and converts them into repositories that are suitable for the current opam version. glow-up arc fr fr ๐Ÿซถ

packages might get created or renamed โ€” that's just part of the process, don't panic โ€” and any compilers defined in the old format (that's the compilers/ directory, iykyk) will be turned into packages, using a pre-defined hierarchy that assumes OCaml compilers. iconic behavior honestly ๐Ÿ‘‘


๐Ÿ’… OPTIONS ๐Ÿ’…

  • --clear-cache โ€” cut from the squad in 2.6. she's gone bestie, removed, archived, no longer invited ๐Ÿ’€
  • -m URL, --mirror=URL โ€” this one is the main character of the section ๐ŸŒˆ don't overwrite the current repository! instead, put an upgraded mirror in place in a subdirectory, with proper redirections and everything. but listen โ€” you need the URL the repository will be served from, because that URL goes into the redirects. why? because older versions of opam literally do not understand relative redirects ๐Ÿ˜ญ like they just can't, so the URL is non-negotiable.

๐ŸŽ€ COMMON OPTIONS ๐ŸŽ€

these options are common to all commands โ€” they're the group chat that's in every conversation, always there, always relevant ๐Ÿ’–

  • --best-effort โ€” don't fail if all requested packages can't be installed; just try to install as many as possible. heads up: not all external solvers may support this option (recent versions of aspcud or mccs should, bestie, they're the good ones ๐Ÿ’…). this is equivalent to setting the $OPAMBESTEFFORT environment variable.
  • --cli=MAJOR.MINOR (absent=2.6) โ€” use the command-line interface syntax and semantics of MAJOR.MINOR. this is intended for any persistent use of opam (scripts, blog posts, etc.), and any version of opam in the same MAJOR series will behave as for the specified MINOR release. important lore alert ๐Ÿ“ข 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. iykyk ๐Ÿงš
  • --color=WHEN โ€” colorize the output ๐Ÿ’– WHEN must be one of always, never or auto.
  • --confirm-level=LEVEL โ€” confirmation level, and LEVEL must be one of ask, no, yes or unsafe-yes. can be specified more than once. if --yes or --no are also given, the value of the last --confirm-level is taken into account. this is equivalent to setting $OPAMCONFIRMLEVEL.
  • --criteria=CRITERIA โ€” specify user preferences for dependency solving for this run. overrides $OPAMCRITERIA, $OPAMFIXUPCRITERIA and $OPAMUPGRADECRITERIA. for the deets on the supported language, and the external solvers available, see http://opam.ocaml.org/doc/External_solvers.html. and a general guide to using solver preferences can be found at http://www.dicosmo.org/Articles/usercriteria.pdf ๐Ÿ“š
  • --cudf=FILENAME โ€” debug option, so it's giving investigator energy ๐Ÿ” it saves the CUDF requests sent to the solver to FILENAME-<n>.cudf where <n> is the n-th call to the solver during the opam run.
  • --debug โ€” print debug message to stderr. this is equivalent to setting $OPAMDEBUG to "true".
  • --debug-level=LEVEL โ€” like --debug, but it lets you specify the debug level (and --debug just sets it to 1). equivalent to setting $OPAMDEBUG to a positive integer.
  • --git-version โ€” print the git version of opam, if it's set (i.e. you're using a development version), and exit. flex if you've got it โœจ
  • --help[=FMT] (default=auto) โ€” show this help in format FMT. the value FMT must be one of auto, pager, groff or plain. with auto, the format is pager or plain whenever the TERM env var is dumb or undefined.
  • --ignore-pin-depends โ€” ignore the extra pins required by packages that get pinned, either manually through opam pin or through opam install DIR. this is equivalent to setting IGNOREPINDEPENDS=true. let it go bestie ๐Ÿ™ˆ
  • --json=FILENAME โ€” save the results of the opam run in a computer-readable file ๐Ÿ’พ if the filename contains the character %, it will be replaced by an index that doesn't overwrite an existing file. similar to setting the $OPAMJSON variable.
  • --no โ€” answer no to all opam yes/no questions without prompting. see also --confirm-level. this is equivalent to setting $OPAMNO to "true".
  • --no-aspcud โ€” removed in 2.1. yeah, she left the chat in 2.1, rest in peace ๐Ÿ’€
  • --no-auto-upgrade โ€” when configuring or updating a repository that is written for an earlier opam version (1.2), opam internally converts it to the current format. this disables that behaviour. note: repositories should define their format version in a repo file at their root, or they will be assumed to be in the older format. it is, in any case, preferable to upgrade the repositories manually using opam admin upgrade [--mirror URL] when possible. manual is the move fr fr ๐Ÿซถ
  • -q, --quiet โ€” disables --verbose. shhh ๐Ÿคซ
  • --root=ROOT โ€” use ROOT as the current root path. this is equivalent to setting $OPAMROOT to ROOT.
  • --safe, --readonly โ€” make sure nothing will be automatically updated or rewritten ๐Ÿ›ก๏ธ useful for calling from completion scripts, for example. will fail whenever such an operation is needed; also avoids waiting for locks, skips interactive questions and overrides the $OPAMDEBUG variable. this is equivalent to set environment variable $OPAMSAFE.
  • --solver=CMD โ€” specify the CUDF solver to use for resolving package installation problems. this is either a predefined solver โ€” and this version of opam supports builtin-mccs+lp(), builtin-mccs+glpk, builtin-dummy-z3-solver, builtin-0install, aspcud, mccs, aspcud-old, packup โ€” or a custom command that should contain the variables %{input}%, %{output}%, %{criteria}%, and optionally %{timeout}%. this is equivalent to setting $OPAMEXTERNALSOLVER. solver variety is the spice of life ๐ŸŒˆ
  • --strict โ€” fail whenever an error is found in a package definition or a configuration file. the default is to continue silently if possible. choose chaos or choose peace, bestie ๐Ÿ˜Œ
  • --switch=SWITCH โ€” use SWITCH as the current compiler switch. this is equivalent to setting $OPAMSWITCH to SWITCH.
  • --use-internal-solver โ€” disable any external solver, and use the built-in one (this requires that opam has been compiled with a built-in solver, so check that first ๐Ÿ‘€). this is equivalent to setting $OPAMNOASPCUD or $OPAMUSEINTERNALSOLVER.
  • -v, --verbose โ€” be more verbose. one -v shows all package commands, and you can repeat it to also display commands called internally (e.g. tar, curl, patch etc.) โ€” repeating n times is equivalent to setting $OPAMVERBOSE to "n". the more v's the more lore ๐Ÿ—ฃ๏ธ
  • --version โ€” show version information.
  • -w, --working-dir โ€” whenever updating packages that are bound to a local, version-controlled directory, update to the current working state of their source instead of the last committed state, or the ref they are pointing to. careful though: as the source directory is copied as it is, if it isn't clean it may result on a opam build failure ๐Ÿ˜ญ this only affects packages explicitly listed on the command-line. it can also be set with $OPAMWORKINGDIR.
  • -y, --yes โ€” answer yes to all opam yes/no questions without prompting. see also --confirm-level. this is equivalent to setting $OPAMYES to "true". yes queen, consent given in advance ๐Ÿ’–

๐ŸŒฑ ENVIRONMENT ๐ŸŒฑ

okay so opam reads a ton of environment variables and honestly bestie, this is the whole list. big one first: boolean variables โ€” set them to "0", "no", "false" or the empty string to disable, and "1", "yes" or "true" to enable. that's the whole vibe check, no cap ๐Ÿ’…

  • OPAMALLPARENS โ€” surround all filters with parenthesis.
  • OPAMASSUMEDEPEXTS โ€” see option `--assume-depexts'.
  • OPAMAUTOANSWER โ€” internal use only. nothing to see here ๐Ÿ™ˆ
  • 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.
  • OPAMBUILDTEST โ€” Removed in 2.1.
  • 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, 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. so many lil placeholders, it's giving mad libs ๐ŸŽ€
  • 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. โœจ parallel slay โœจ
  • 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. โš ๏ธ old news bestie
  • 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. bestie do NOT ship this to prod ๐Ÿ˜ญ
  • 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.
  • OPAMSTATUSLINE โ€” display a dynamic status line showing what's currently going on on the terminal. (one of always, never or auto) ๐Ÿ‘€ it's watching
  • 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. ๐Ÿ’€ literally just don't
  • 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. OPAMYEShas priority overOPAMNOand is ignored ifOPAMCONFIRMLEVEL` 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 ๐Ÿฆ‹

bestie this section is IMPORTANT so pls don't skim ๐Ÿซถ

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. Additionally, blog posts or other documentation can benefit, as it prevents information from becoming stale.

Although opam only supports roots (~/.opam/) for the current version, it does provide backwards compatibility for its command-line interface.

Since CLI version support was only added in opam 2.1, use OPAMCLI to select 2.0 support (as opam 2.0 will just ignore it), and --cli=2.1 for 2.1 (or later) versions, since 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.

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. โœจ last one wins, main character energy โœจ

๐Ÿšฆ EXIT STATUS ๐Ÿšฆ

okay bestie, listen up โ€” the exit code is literally the receipts ๐Ÿ’… every time you run opam, it whispers a number back to your shell, and that number tells you exactly what went down. here's the decoder ring โœจ

โš ๏ธ one exception, and it's a big one: the exec command does NOT play by these rules. if the command wasn't found or couldn't be executed, it returns 127. otherwise, it hands you back the command's own exit value. periodt.
  • 0 โ€” success! ๐ŸŽ‰ or true for boolean queries. she ate.
  • 1 โ€” false. you get this when a boolean return value is expected โ€” like when you're running with --check, or for queries like opam lint. it's not an error, it's just a no ๐Ÿ’€
  • 2 โ€” bad command-line arguments, or arguments pointing at an invalid context (e.g. a file that doesn't follow the expected format). your typing gave, unfortunately ๐Ÿ˜ญ
  • 5 โ€” not found. you asked for something (a package, a version, a repository, etc.) and it simply does not exist. ghosted fr ๐Ÿซฅ
  • 10 โ€” aborted. the operation needed confirmation and you didn't give it. you said no, or you justโ€ฆ didn't say yes ๐Ÿ™ˆ
  • 15 โ€” could not acquire the locks required for the operation. someone else is holding the keys ๐Ÿ”’
  • 20 โ€” there's no solution to your request. like asking to install two incompatible packages, for example. the audacity ๐Ÿ’€
  • 30 โ€” error in package definition, or other metadata files. using --strict raises this error more often. sensitive much? โœจ
  • 31 โ€” package script error. some package operations were unsuccessful. could be an error in the packages themselves, or an incompatibility with your system. and heads up โ€” this can be a partial error ๐Ÿ“
  • 40 โ€” sync error. couldn't fetch some remotes from the network. also can be a partial error ๐Ÿ“ก
  • 50 โ€” configuration error. opam or your system config doesn't allow the operation, and it needs fixing. bestie, go fix it ๐Ÿ’–
  • 60 โ€” solver failure. the solver failed to return a sound answer. could be a broken external solver, or an error in solver configuration. the math said no ๐Ÿงฎ
  • 99 โ€” internal error. something went wrong, likely due to a bug in opam itself. not your fault, bestie, blame the code ๐Ÿ›
  • 130 โ€” user interrupt. SIGINT was received โ€” generally because you pressed Ctrl+C. you panicked, it's fine, we've all been there ๐Ÿ˜ญ

and then there's this little trio, which means what it says on the tin:

  • 0 โ€” on success. (yes again, iconic consistency ๐Ÿ‘‘)
  • 123 โ€” on indiscriminate errors reported on standard error.
  • 124 โ€” on command line parsing errors.
  • 125 โ€” on unexpected internal errors (bugs).

๐Ÿ“š FURTHER DOCUMENTATION ๐Ÿ“š

want more lore? the full docs live at https://opam.ocaml.org/doc. go read, she's worth it ๐ŸŒˆ


๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

giving credit where credit is due, because these legends built the thing ๐Ÿซถ

  • 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>

๐ŸŒธ SEE ALSO ๐ŸŒธ

  • opam admin(1) โ€” the main character of this whole saga ๐Ÿ’…

๐Ÿ› BUGS ๐Ÿ›

found something cursed? check the bug reports at https://github.com/ocaml/opam/issues โ€” don't suffer in silence, bestie ๐Ÿ’œ


and that's a wrap on OPAM ADMIN-UPGRADE(1) ๐ŸŒˆ โ€” this one's from Opam admin 2.6.1, dated the day the manpage was written โœจ go forth and upgrade responsibly, you absolute icon ๐ŸŽ€๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from