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 ofaspcudormccsshould be fine). this is equivalent to setting the$OPAMBESTEFFORTenvironment variable. lowkey forgiving, we love that π«Ά--cli=MAJOR.MINOR(absent=2.6) β use the command-line interface syntax and semantics ofMAJOR.MINOR. intended for any persistent use of opam (scripts, blog posts, etc.), any version of opam in the sameMAJORseries will behave as for the specifiedMINORrelease. the flag was not available in opam 2.0, so to select the 2.0 CLI, set theOPAMCLIenvironment variable to2.0instead of using this parameter. time travel but make it a CLI β³--color=WHENβ colorize the output.WHENmust be one ofalways,neverorauto. aesthetic choices are valid π--confirm-level=LEVELβ confirmation level,LEVELmust be one ofask,no,yesorunsafe-yes. can be specified more than once. if--yesor--noare also given, the value of the last--confirm-levelis 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,$OPAMFIXUPCRITERIAand$OPAMUPGRADECRITERIA. for details on the supported language, and the external solvers available, seehttp://opam.ocaml.org/doc/External_solvers.html. a general guide to using solver preferences can be found athttp://www.dicosmo.org/Articles/usercriteria.pdf. she's giving scholar πβ¨--cudf=FILENAMEβ debug option: save the CUDF requests sent to the solver toFILENAME-<n>.cudfwhere<n>is the n-th call to the solver during the opam run. nerd mode activated π--debugβ print debug message tostderr. this is equivalent to setting$OPAMDEBUGto"true". she's telling you EVERYTHING π--debug-level=LEVELβ like--debug, but allows specifying the debug level (--debugsets it to1). equivalent to setting$OPAMDEBUGto 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 formatFMT. the valueFMTmust be one ofauto,pager,grofforplain. withauto, the format ispagerorplainwhenever theTERMenv var isdumbor undefined. she's helpful AND adaptable π--ignore-pin-dependsβ ignore extra pins required by packages that get pinned, either manually throughopam pinor throughopam install DIR. this is equivalent to settingIGNOREPINDEPENDS=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$OPAMJSONvariable. data girlies rise π--noβ answer no to all opam yes/no questions without prompting. see also--confirm-level. this is equivalent to setting$OPAMNOto"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 arepofile 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 usingopam admin upgrade [--mirror URL]when possible. manual > automatic here, bestie π-q,--quietβ disables--verbose. shhh, we're being mysterious π€«--root=ROOTβ useROOTas the current root path. this is equivalent to setting$OPAMROOTtoROOT. 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$OPAMDEBUGvariable. 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 supportsbuiltin-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β useSWITCHas the current compiler switch. this is equivalent to setting$OPAMSWITCHtoSWITCH. 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$OPAMNOASPCUDor$OPAMUSEINTERNALSOLVER. going solo, no outside opinions π«Ά-v,--verboseβ be more verbose. one-vshows all package commands, repeat to also display commands called internally (e.g.tar,curl,patchetc.) repeating n times is equivalent to setting$OPAMVERBOSEto"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$OPAMYESto"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-effortoption is set, and is expected to maximise theopam-queryproperty in the solution.OPAMBUILDDOCβ Removed in 2.1. π gone bestieOPAMBUILDTESTβ Removed in 2.1. also gone πOPAMCLIβ see option--cli.OPAMCOLORβ when set to always or never, sets a default value for the--coloroption.OPAMCONFIRMLEVELβ see option--confirm-level. Heads up:OPAMCONFIRMLEVELhas priority overOPAMYESandOPAMNO. so it wins the argument, periodt.OPAMCRITERIAβ specifies user preferences for dependency solving. The default value depends on the solver version, useconfig reportto 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. 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-diron 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$EDITORand$VISUAL. it's giving main character energy, it simply overrules them π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 the 'download-command' value 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. (it lowkey gets overruled, sorry babe π₯²)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, on 'update' or 'init'.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 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-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. β οΈ not for everyday use bestie, put it downOPAMSOLVERALLOWSUBOPTIMALβ (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 willcontinue with a warning, iffalsea timeout is an error. Currently only the builtin-z3 backend 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 of one of always, never or auto)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 of one of always, never or auto). 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 tbhOPAMVALIDATIONHOOKβ 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'tOPAMWITHDEVSETUPβ 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. (yes has hands, but confirm-level has more hands π )OPAMVAR_varβ overrides the contents of the variable var when substituting%{var}%strings inopamfiles.OPAMVAR_package_varβ overrides the contents of the variable package:var when substituting%{package:var}%strings inopamfiles.
π 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 β¨ ortruefor 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 likeopam 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--strictraises 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.SIGINTwas received, generally because the user pressed Ctrl+C. you did this. it was you. π
And also, the standard ones:
0on success.123on indiscriminate errors reported on standard error.124on command line parsing errors.125on 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
- 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