OPAM-ADMIN-INDEX(1)

๐ŸŒธ OPAM-ADMIN-INDEX ๐Ÿ’…

okay bestie, you found it โ€” the Opam admin Manual page for opam admin index, and she is long, so buckle up. This is part 1 of 3, so don't go anywhere. ๐Ÿซถ


โœจ NAME โœจ

opam admin-index โ€” Generate an inclusive index file for serving over HTTP.


โœจ SYNOPSIS โœจ

opam admin index [--full-urls-txt] [--minimal-urls-txt] [--no-urls-txt]
[OPTION]โ€ฆ

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

So here's the vibe ๐ŸŒˆ โ€” you can serve an opam repository over HTTP or HTTPS using literally any web server. Iconic. But to do that, you've gotta generate an inclusive index first, and that's the whole job of this command. It spits out the files the opam client will be expecting when it fetches from an HTTP remote. ๐Ÿ’…

โš ๏ธ bestie listen: you have to run this after any changes are made to the contents of the repository. No exceptions, fr fr.

๐ŸŽ€ OPTIONS ๐ŸŽ€

  • --full-urls-txt โ€” generates an inclusive urls.txt, for repositories that are gonna be used by opam versions earlier than 2.0. Old-school, but she serves. ๐Ÿ‘‘
  • --minimal-urls-txt โ€” generates a minimal urls.txt file that only includes the repo file. This lets opam versions earlier than 2.0 read that file and get properly redirected to a repository made just for their version (assuming a suitable redirect: field is defined) instead of justโ€ฆ failing. ๐Ÿ˜ญ This is the default.
  • --no-urls-txt โ€” don't generate a urls.txt file at all. Like, that index file is no longer needed from opam 2.0 onward, but older versions still use it. So it's giving legacy. ๐Ÿ’€

๐Ÿ’– COMMON OPTIONS ๐Ÿ’–

These ones are common to all commands, so they're the shared friend group of the opam CLI. ๐Ÿซถ

  • --best-effort โ€” don't fail if all the requested packages can't be installed: just try to install as many as possible. ngl, not every external solver supports this (recent versions of aspcud or mccs should though). 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 for any persistent use of opam (scripts, blog posts, etc.), so any version of opam in the same MAJOR series will behave as for the specified MINOR release. Heads up though: this flag wasn't available in opam 2.0, so to select the 2.0 CLI you gotta 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, where 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 the one that counts. Equivalent to setting $OPAMCONFIRMLEVEL. โญ
  • --criteria=CRITERIA โ€” specify user preferences for dependency solving for this run. Overrides $OPAMCRITERIA, $OPAMFIXUPCRITERIA and $OPAMUPGRADECRITERIA. For deets on the supported language and the external solvers available, peep http://opam.ocaml.org/doc/External_solvers.html. And a general guide to using solver preferences lives at http://www.dicosmo.org/Articles/usercriteria.pdf. ๐Ÿ“š
  • --cudf=FILENAME โ€” debug option, bestie: save 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 messages to stderr. Equivalent to setting $OPAMDEBUG to "true". ๐Ÿ™ˆ
  • --debug-level=LEVEL โ€” like --debug, but lets you specify the debug level (--debug 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. ๐Ÿ‘‘
  • --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 extra pins required by packages that get pinned, whether manually through opam pin or through opam install DIR. Equivalent to setting IGNOREPINDEPENDS=true.
  • --json=FILENAME โ€” save the results of the opam run into a computer-readable file. If the filename contains the character %, it gets 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. Equivalent to setting $OPAMNO to "true".
  • --no-aspcud โ€” Removed in 2.1. ๐Ÿ’€
  • --no-auto-upgrade โ€” when configuring or updating a repository that's written for an earlier opam version (1.2), opam internally converts it to the current format. This disables that behaviour. Note that repositories should define their format version in a repo file at their root, or they'll be assumed to be in the older format. And honestly? It's preferable in any case to upgrade the repositories manually using opam admin upgrade [--mirror URL] when possible. ๐ŸŽ€
  • -q, --quiet โ€” disables --verbose. ๐Ÿคซ
  • --root=ROOT โ€” use ROOT as the current root path. Equivalent to setting $OPAMROOT to ROOT.
  • --safe, --readonly โ€” make sure nothing gets automatically updated or rewritten. Super useful for calling from completion scripts, for example. It will fail whenever such an operation is needed; it also avoids waiting for locks, skips interactive questions, and overrides the $OPAMDEBUG variable. Equivalent to setting the environment variable $OPAMSAFE. ๐Ÿ›ก๏ธ
  • --solver=CMD โ€” specify the CUDF solver to use for resolving package installation problems. This is either a predefined solver (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}%. Equivalent to setting $OPAMEXTERNALSOLVER. ๐Ÿ”ฅ
  • --strict โ€” fail whenever an error is found in a package definition or a configuration file. The default is to continue silently if possible. (Yes, the default is chill. This flag is the opposite of chill.)
  • --switch=SWITCH โ€” use SWITCH as the current compiler switch. 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). Equivalent to setting $OPAMNOASPCUD or $OPAMUSEINTERNALSOLVER. ๐ŸŒธ
  • -v, --verbose โ€” be more verbose. One -v shows all package commands; repeat it to also display commands called internally (e.g. tar, curl, patch, etc.). Repeating n times is equivalent to setting $OPAMVERBOSE to "n". ๐Ÿ—ฃ๏ธ
  • --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're pointing to. And since the source directory is copied as it is, if it isn't clean it may result in an 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. Equivalent to setting $OPAMYES to "true". ๐Ÿ’…

okay that's part 1, bestie โ€” more parts incoming, so stay tuned ๐Ÿฆ‹โœจ

๐ŸŒฑ ENVIRONMENT ๐ŸŒฑ

okay bestie, opam reads a TON of environment variables and you're gonna want to know them, so buckle up. ๐Ÿ’–

Quick rules for the boolean ones: to turn them off, set them to "0", "no", "false", or just the empty string. To turn them on, set "1", "yes", or "true". that's it, that's the whole system, periodt. โœจ

  • OPAMALLPARENS โ€” surround all filters with parenthesis.
  • OPAMASSUMEDEPEXTS โ€” see option --assume-depexts.
  • OPAMAUTOANSWER โ€” internal use only. ๐Ÿ™ˆ
  • 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. Heads up: 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.
  • 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. ๐Ÿ’€
  • OPAMSTATUSLINE โ€” display a dynamic status line showing what's currently going on on the terminal. (one of 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 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. ๐Ÿช
  • 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. ๐Ÿšซ
  • 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 ๐Ÿ•ฐ๏ธ

okay so literally every script and programmatic invocation of opam should be using --cli, no cap. Why? Because it keeps your stuff working seamlessly with future versions of the opam client. โœจ And bonus: blog posts and other documentation lowkey benefit too, because it stops the info from going stale. ๐Ÿ‘‘

Even though opam only supports roots (~/.opam/) for the current version, it does provide backwards compatibility for its command-line interface. iconic of it honestly. ๐Ÿ’…

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 morethan once, where the last instance takes precedence. OPAMCLI is only inspected if --cli is not given.

bestie the way that last-instance-wins thing works is giving "last one to speak gets the mic" and honestly? correct. ๐ŸŽค

๐Ÿ’€ EXIT STATUS ๐Ÿ’€

Okay bestie, this is the part where opam tells you why it left. Every command exits with a number, and each number is a little mood ring for what just happened. ๐Ÿ‘‘

โš ๏ธ One exception, and it's a big one: the exec command doesn't play by these rules at all. It returns 127 if the command wasn't found or couldn't be executed, and the command's own exit value otherwise. That's it. That's the whole tea. ๐Ÿซ–

Now for the regular lineup:

  • 0 โ€” Slay. Success, or true for boolean queries. โœจ
  • 1 โ€” False. This one shows up when a boolean return value is expected โ€” like when you're running with --check, or for queries like opam lint. Not a crash, just a "no, girl." ๐Ÿ™…
  • 2 โ€” Bad command-line arguments, or arguments pointing at an invalid context (say, a file that doesn't follow the expected format). You gave it nonsense, it said no. ๐Ÿ˜ญ
  • 5 โ€” Not found. You asked for something (a package, a version, a repository, etc.) and it simply was not there. Gone. Missing. ๐Ÿ’€
  • 10 โ€” Aborted. The operation needed confirmation and you didn't give it. The vibe check failed. ๐Ÿšซ
  • 15 โ€” Could not acquire the locks required for the operation. Something else was already holding the door. ๐Ÿ”’
  • 20 โ€” There is no solution to the user request. Classic cause: asking to install two incompatible packages. The math said no. โž—
  • 30 โ€” Error in package definition, or other metadata files. And heads up: using --strict raises this error more often. ๐Ÿ“‹
  • 31 โ€” Package script error. Some package operations were unsuccessful. Might be an error in the packages, might be an incompatibility with your system. And note: 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 system configuration doesn't allow the operation, and it needs fixing before you can move on. ๐Ÿ”ง
  • 60 โ€” Solver failure. The solver failed to return a sound answer. Could be a broken external solver, or an error in solver configuration. ๐Ÿงฎ
  • 99 โ€” Internal error. Something went wrong, and it's most likely a bug in opam itself. Not you, bestie โ€” it's them. ๐Ÿ›
  • 130 โ€” User interrupt. SIGINT was received, generally because the user pressed Ctrl+C. You did this. We both know you did this. ๐Ÿ˜Œ

And then there's this lil secondary squad, which goes like:

  • 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 ๐Ÿ“š

The full lore lives at <https://opam.ocaml.org/doc>. Go read it. It's giving encyclopedia but make it OCaml. ๐Ÿฆ‹


๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

These are the icons who built this. Respect the roster, fr fr:

  • 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) โ€” go check out the main character, iykyk. ๐Ÿ’…

๐Ÿž BUGS ๐Ÿž

Found something cursed? Check bug reports at <https://github.com/ocaml/opam/issues>. Tell them everything, they want to know. ๐ŸŒธ


And that's a wrap on part 3, babe! ๐ŸŽ€ This whole page is courtesy of Opam admin 2.6.1, filed under OPAM ADMIN-INDEX(1) โ€” that's the version and the section it lives in, so now you know exactly what you're reading. Go forth and admin index with confidence. You ate. Periodt. ๐Ÿ’–โœจ

๐Ÿ“ฆ where this page comes from