OPAM-ADMIN-ADD-HASHES(1)

πŸ’… opam admin-add-hashes β€” the Opam admin manual, bestie edition ✨

okay so. grab a snack πŸ“ because we're about to add hashes to an opam repository and honestly it's gonna be iconic.


✨ NAME ✨

opam admin-add-hashes β€” adds archive hashes to an opam repository. that's it, that's the job, and she does it gorgeously πŸ’–


🌸 SYNOPSIS 🌸

opam admin add-hashes [--packages=PACKAGES] [--replace] [OPTION]… HASH_ALGO…

like… you literally just tell her which hash algorithm(s) you want and she goes off πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so the tea is: this command scans through your package definitions and adds the hashes you asked for. and if she needs the archives to do that? she fetches them herself. no cap, she's self-sufficient πŸ’…

and because she's a considerate queen, a cache gets generated in <opamroot>/download-cache/hash-cache so that subsequent runs don't have to do all that work again. main character energy but make it efficient ✨


πŸŽ€ ARGUMENTS πŸŽ€

  • HASH_ALGO (required! don't skip her) β€” the hash, or hashes, to be added. give her one, give her several, she's flexible 🫢

πŸ’œ OPTIONS πŸ’œ

  • -p PACKAGES, --packages=PACKAGES β€” only add hashes for the given packages. like a little filter, a curated guest list πŸŽ€
  • --replace β€” replace the existing hashes instead of adding to them. out with the old, in with the new, glow-up style πŸ’…

🌈 COMMON OPTIONS 🌈

these are the options that every single opam command shares. the universal friend group, if you will. iykyk πŸ’–

  • --best-effort β€” don't fail just because not all the requested packages can be installed; try to install as many as possible instead. heads up though: not all external solvers support this option (recent versions of aspcud or mccs should be fine). this is equivalent to setting the $OPAMBESTEFFORT environment variable. lowkey forgiving, we love that 🫢
  • --cli=MAJOR.MINOR (absent=2.6) β€” 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. time travel but make it a CLI ⏳
  • --color=WHEN β€” colorize the output. WHEN must be one of always, never or auto. aesthetic choices are valid 🌈
  • --confirm-level=LEVEL β€” confirmation level, 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. yes bestie, order matters πŸ™ˆ
  • --criteria=CRITERIA β€” specify user preferences for dependency solving for this run. overrides $OPAMCRITERIA, $OPAMFIXUPCRITERIA and $OPAMUPGRADECRITERIA. for details on the supported language, and the external solvers available, see http://opam.ocaml.org/doc/External_solvers.html. a general guide to using solver preferences can be found at http://www.dicosmo.org/Articles/usercriteria.pdf. she's giving scholar πŸ“šβœ¨
  • --cudf=FILENAME β€” debug option: 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. nerd mode activated πŸ”
  • --debug β€” print debug message to stderr. this is equivalent to setting $OPAMDEBUG to "true". she's telling you EVERYTHING πŸ’€
  • --debug-level=LEVEL β€” like --debug, but allows specifying the debug level (--debug sets it to 1). equivalent to setting $OPAMDEBUG to a positive integer. dial it up, dial it down, it's your world 🌍
  • --git-version β€” print the git version of opam, if set (i.e. you are using a development version), and exit. a lil flex for the dev girlies πŸ‘‘
  • --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. she's helpful AND adaptable πŸ’–
  • --ignore-pin-depends β€” ignore 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. not today, dependencies πŸ™…
  • --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. data girlies rise πŸ“Š
  • --no β€” answer no to all opam yes/no questions without prompting. see also --confirm-level. this is equivalent to setting $OPAMNO to "true". respectfully: nope 🚫
  • --no-aspcud β€” removed in 2.1. she's gone, she's retired, we don't talk about her πŸ’€
  • --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 this behaviour. note that 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 > automatic here, bestie πŸŽ€
  • -q, --quiet β€” disables --verbose. shhh, we're being mysterious 🀫
  • --root=ROOT β€” use ROOT as the current root path. this is equivalent to setting $OPAMROOT to ROOT. your home, your rules 🏠
  • --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. she's in her protected era πŸ›‘οΈ
  • --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}%. this is equivalent to setting $OPAMEXTERNALSOLVER. pick your fighter πŸ₯Š
  • --strict β€” fail whenever an error is found in a package definition or a configuration file. the default is to continue silently if possible. no more sweeping things under the rug 🧹
  • --switch=SWITCH β€” use SWITCH as the current compiler switch. this is equivalent to setting $OPAMSWITCH to SWITCH. switching it up, as one does πŸ’…
  • --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). this is equivalent to setting $OPAMNOASPCUD or $OPAMUSEINTERNALSOLVER. going solo, no outside opinions 🫢
  • -v, --verbose β€” be more verbose. one -v shows all package commands, repeat to also display commands called internally (e.g. tar, curl, patch etc.) repeating n times is equivalent to setting $OPAMVERBOSE to "n". the way she just keeps talking and we love her for it πŸ—£οΈπŸ’–
  • --version β€” show version information. the classic, the icon, the moment ⭐
  • -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. as 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. live your uncommitted truth, but carefully 😭
  • -y, --yes β€” answer yes to all opam yes/no questions without prompting. see also --confirm-level. this is equivalent to setting $OPAMYES to "true". consent via flag, we stan a straightforward queen πŸ‘‘

πŸ’– ENVIRONMENT πŸ’–

okay bestie, this is the big one β€” opam reads a whooole bunch of environment variables, and here's the whole list. First, the rule for the boolean girlies: Boolean variables should be set to "0", "no", "false" or the empty string to disable, "1", "yes" or "true" to enable. That's it, that's the vibe check. ✨

  • OPAMALLPARENS β€” surround all filters with parenthesis. yes queen, all of them 🫢
  • OPAMASSUMEDEPEXTS β€” see option --assume-depexts.
  • OPAMAUTOANSWER β€” internal use only. (mind your business πŸ’…)
  • 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 bestie
  • 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. Heads up: OPAMCONFIRMLEVEL has priority over OPAMYES and OPAMNO. so it wins the argument, periodt.
  • 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. it's giving main character energy, it simply overrules them 😌
  • 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. (it lowkey gets overruled, sorry babe πŸ₯²)
  • 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. ⚠️ not for everyday use bestie, put it down
  • 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 willcontinue 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 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. πŸͺ iconic tbh
  • 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. 🚫 seriously, 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. OPAMYES has priority over OPAMNO and is ignored if OPAMCONFIRMLEVEL is set. (yes has hands, but confirm-level has more hands πŸ’…)
  • 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 🌈

kay so this is where it gets ✨ futuristic ✨. 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. no cap, future-proof your whole life.

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 warning is real, she's just looking out for you.

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. so like, last flag wins, and if you already said it on the command line, OPAMCLI doesn't even get a vote 🫢

πŸ’₯ EXIT STATUS πŸ’₯

okay bestie, one teeny exception first: the exec command is a lil different β€” it returns 127 if the command wasn't found or couldn't be executed, and otherwise it just hands you back the command's own exit value. iconic behaviour, honestly.

Otherwise, here's the whole vibe-check chart of what opam's exit codes mean:

  • 0 β€” Success ✨ or true for boolean queries. we love a happy ending.
  • 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. ngl it's not an error, it's just a "no" 🚫
  • 2 β€” Bad command-line arguments, or args that point at an invalid context (e.g. a file that doesn't follow the expected format). basically: huh? 🀨
  • 5 β€” Not found. You asked for something β€” package, version, repository, etc. β€” and it just... wasn't there. πŸ’€
  • 10 β€” Aborted. The operation needed confirmation and you didn't give it. it's giving "changed my mind".
  • 15 β€” Could not acquire the locks required for the operation. someone's holding the door πŸ”’
  • 20 β€” There is no solution to the user request. this happens when you ask to install two incompatible packages, for example. lowkey rude of you tbh.
  • 30 β€” Error in package definition, or other metadata files. Using --strict raises this error more often. so keep that in mind bestie πŸ‘€
  • 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. This can be a partial error too. wifi said no πŸ“‘
  • 50 β€” Configuration error. Opam or system configuration doesn't allow the operation, and needs fixing. fix it and come back πŸ› οΈ
  • 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. the solver is not slaying today 😭
  • 99 β€” Internal error. Something went wrong, likely due to a bug in opam itself. not us, it's opam 🫢
  • 130 β€” User interrupt. SIGINT was received, generally because the user pressed Ctrl+C. you did this. it was you. πŸ™ˆ

And also, the standard ones:

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

Go read <https://opam.ocaml.org/doc>. that's the spot. πŸ’…


πŸ‘‘ AUTHORS πŸ‘‘

the literal main characters who made this happen, periodt:

  • 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) β€” your other bestie, go say hi

πŸ› BUGS πŸ›

Found something cursed? Check bug reports at <https://github.com/ocaml/opam/issues>. drop it in the group chat, we'll figure it out together πŸ’–


aaaand that's a wrap on OPAM ADMIN-ADD-HASHES(1) πŸŽ€ this page is from Opam admin 2.6.1, so if your version says something else, that's between you and your distro bestie. mwah, go hash some stuff πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from