OPAM-ADMIN-MIGRATE-EXTRAFILES(1)
โจ NAME โจ
opam admin-migrate-extrafiles โ Move extra-files to extra-source.
yep that's it, that's the whole job ๐
this one lives in the Opam admin Manual, bestie โ page OPAM-ADMIN-MIGRATE-EXTRAFILES(1), and it is such a useful little gremlin.
๐ธ SYNOPSIS ๐ธ
opam admin migrate-extrafiles [--hash=HASH_ALGO] [--packages=PACKAGES]
[OPTION]โฆ DIR URL
๐ฆ DESCRIPTION ๐ฆ
okay so picture this: this command scans through package definitions, and then it migrates all extra-files fields to extra-source, exactly as requested. no drama, no cap, it just does the thing ๐
๐ ARGUMENTS ๐
DIR(required) โ the name of the local directory where the extra-files are gonna go live. They get put intoDIR/patches/<pkgname>/<pkgname.version>/filenameYY๐URL(required) โ the prefix of the URL to emit into extra-sources. so it's like, the front half of the address, and opam handles the rest โจ
๐ OPTIONS ๐
--hash=HASH_ALGO(absent=sha256) โ the hash, or the hashes, to be added ๐-pPACKAGES,--packages=PACKAGESโ only add extra files for the given packages, like, keep it to this list bestie ๐ฏ
๐ COMMON OPTIONS ๐
these ones are common to all commands, so they show up literally everywhere. it's giving shared wardrobe ๐
--best-effortโ don't fail if all the requested packages can't be installed; just try to install as many as possible. heads up tho: not all external solvers may support this option (recent versions ofaspcudormccsshould). This is equivalent to setting the$OPAMBESTEFFORTenvironment variable.--cli=MAJOR.MINOR(absent=2.6) โ use the command-line interface syntax and semantics ofMAJOR.MINOR. It's intended for any persistent use of opam (scripts, blog posts, etc.), and 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. ๐--color=WHENโ colorize the output.WHENmust be one ofalways,neverorauto. ๐จ--confirm-level=LEVELโ confirmation level, andLEVELmust 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`` โ yup, the manpage really does have a stray backtick hanging off the end of that one, we keep it exactly as written, iconic ๐ฅ--criteria=CRITERIAโ specify user preferences for dependency solving for this run. It 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. ๐--cudf=FILENAMEโ debug option: save the CUDF requests sent to the solver toFILENAME-<n>.cudf, where<n>is the n-th call to the solver during the opam run. ๐--debugโ print debug message tostderr. This is equivalent to setting$OPAMDEBUGto"true". ๐--debug-level=LEVELโ like--debug, but it lets you specify the debug level (--debugsets it to1). Equivalent to setting$OPAMDEBUGto 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 formatFMT. The valueFMTmust be one ofauto,pager,grofforplain. Withauto, the format ispagerorplainwhenever theTERMenv var isdumbor undefined. ๐ซถ--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. ๐--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. ๐ค--noโ answer no to all opam yes/no questions without prompting. See also--confirm-level. This is equivalent to setting$OPAMNOto"true". ๐ โโ๏ธ--no-aspcudโ Removed in 2.1. it's gone bestie, it's in the past ๐--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 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 usingopam admin upgrade [--mirror URL]when possible. ๐ฆ-q,--quietโ disables--verbose. shhh ๐คซ--root=ROOTโ useROOTas the current root path. This is equivalent to setting$OPAMROOTtoROOT. ๐ณ--safe,--readonlyโ make sure nothing will be 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$OPAMDEBUGvariable. This is equivalent to set environment variable$OPAMSAFE. > like, nothing is touching your files, periodt. ๐--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. ๐ง--strictโ fail whenever an error is found in a package definition or a configuration file. The default is to continue silently if possible. ๐ค--switch=SWITCHโ useSWITCHas the current compiler switch. This is equivalent to setting$OPAMSWITCHtoSWITCH. ๐--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. ๐-v,--verboseโ be more verbose. One-vshows all package commands, and repeating it also displays commands called internally (e.g.tar,curl,patch, etc.). Repeating n times is equivalent to setting$OPAMVERBOSEto"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 are pointing to. Since 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$OPAMYESto"true". โ
So here's the deal, bestie: opam reads a whole little wardrobe of environment variables. Bool ones are โจmoodโจ โ set them to "0", "no", "false" or just leave them empty to turn the thing off, and set them to "1", "yes" or "true" to turn it on.
OPAMALLPARENSโ wraps every filter in parenthesis, no exceptions ๐OPAMASSUMEDEPEXTSโ the env var twin of the option `--assume-depexts'.OPAMAUTOANSWERโ internal use only, don't touch, that's not for us ๐OPAMAUTOREMOVEโ matches the remove option `--auto-remove'.OPAMBESTEFFORTโ matches the option `--best-effort'.OPAMBESTEFFORTPREFIXCRITERIAโ sets the string that gets prepended onto the criteria whenever the--best-effort' option is on, and it's expected to maximise theopam-query' property in the solution.OPAMBUILDDOCโ Removed in 2.1. gone, deceased, no longer with us ๐OPAMBUILDTESTโ also Removed in 2.1.OPAMCLIโ matches the option `--cli'.OPAMCOLORโ set it toalwaysorneverand it sets a default value for the `--color' option.OPAMCONFIRMLEVELโ matches the option--confirm-level. Heads up:OPAMCONFIRMLEVELoutranks bothOPAMYESandOPAMNO.OPAMCRITERIAโ your โจpersonal vibeโจ for dependency solving, aka user preference. The default value depends on the solver version, so runconfig report' to find out what's currently set. Also peep the option--criteria`.OPAMCUDFFILEโ saves the cudf graph out to the filefile-actions-explicit.dot.OPAMCUDFTRIMโ controls how unrelated packages get filtered out during CUDF preprocessing.OPAMCURLโ lets you pick whichcurlprogram gets used. SeeOPAMFETCHfor the rest of the options.OPAMDEBUGโ matches the options--debug' and--debug-level'.OPAMDEBUGSECTIONSโ if you set it, debug messages get limited to that space-separated list of sections. Sections can optionally carry their own specific debug level (likeCLIENT:2orCLIENT CUDF:2), otherwise it falls back to `--debug-level'.OPAMDIGDEPTHโ defines how aggressive the lookup for conflicts is during CUDF preprocessing.OPAMDOWNLOADJOBSโ sets the maximum number of downloads happening at the same time.OPAMDROPWORKINGDIRโ overrides packages that were previously updated with--working-diron update. Without this variable set, opam would leave them unchanged unless you explicitly name them on the command-line.OPAMDRYRUNโ matches the option `--dry-run'.OPAMEDITORโ sets the editor used for editing opam files, and it overrides$EDITORand$VISUAL. yes it's that bossy ๐OPAMERRLOGLENโ sets how many log lines get printed when a sub-process fails. Set it to0to print literally all of them.OPAMEXTERNALSOLVERโ matches the option `--solver'.OPAMFAKEโ matches the option `--fake'.OPAMFETCHโ tells opam how to download files: eitherwget,curl, or a custom command where the variables%{url}%,%{out}%,%{retry}%,%{compress}%and%{checksum}%all get replaced. This overrides thedownload-commandvalue from the main config file.OPAMFIXUPCRITERIAโ same energy asOPAMUPGRADECRITERIA, but specifically for fixup and reinstall.OPAMIGNOREAVAILABLEโ matches the install option `--ignore-available-on'.OPAMIGNORECONSTRAINTSโ matches the install option `--ignore-constraints-on'.OPAMIGNOREPINDEPENDSโ matches the option `--ignore-pin-depends'.OPAMINPLACEBUILDโ matches the option `--inplace-build'.OPAMJOBSโ sets the max number of parallel workers to run.OPAMJSONโ logs json output into the file you give it (use the character%to index the files).OPAMKEEPBUILDDIRโ matches the install option `--keep-build-dir'.OPAMKEEPLOGSโ tells opam to not remove some temporary command logs and some backups. It skips some finalisers and it may also help you get more reliable backtraces.OPAMLOCKEDโ the combination of the--locked' and--lock-suffix' options.OPAMLOGSโlogdirโ sets the log directory, and the default is a temporary directory inside/tmp.OPAMMAKECMDโ sets the systemmakecommand to use.OPAMMERGEOUTโ merges process outputs, with stderr landing on stdout.OPAMNOโ answers no to any question asked, see the options--noand--confirm-level.OPAMNOgets ignored if eitherOPAMCONFIRMLEVELorOPAMYESis set. sorry babe, you got overruled ๐OPAMNOAGGREGATEโ with `opam admin check', don't aggregate packages.OPAMNOASPCUDโ Deprecated.OPAMNOAUTOUPGRADEโ disables the automatic internal upgrade of repositories in an earlier format to the current one, which normally happens on'update'or'init'.OPAMNOCHECKSUMSโ enables the option--no-checksumswhenever it's available.OPAMNODEPEXTSโ disables system dependencies handling, see the option `--no-depexts'.OPAMNOENVNOTICEโ Internal.OPAMNOSELFUPGRADEโ matches the option--no-self-upgrade'.OPAMPINKINDAUTOโ sets whether version control systems should get detected when pinning to a local path. Enabled by default since 1.3.0.OPAMPRECISETRACKINGโ fine grain tracking of directories.OPAMPREPROโ set this tofalseto disable CUDF preprocessing. It's less efficient, but it might help you debug a solver issue.OPAMREPOSITORYTARRINGโ internally stores all non-vcs repositories astar.gzfiles (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, with no I/O for scanning the repository.OPAMREQUIRECHECKSUMSโ enables the option--require-checksums'whenever it's available (e.g. for `opam install').OPAMRETRIESโ sets the number of tries before downloads just give up and fail.OPAMREUSEBUILDDIRโ matches the option `--reuse-build-dir'.OPAMROOTโ matches the option--root'. It gets set automatically byopam env --root=DIR --set-root'`.OPAMROOTISOKโ don't complain when running as root. living dangerously, love that for you ๐ฅOPAMSAFEโ matches the option `--safe'.OPAMSHOWโ matches the option `--show'.OPAMSKIPUPDATEโ matches the option `--skip-updates'.OPAMSKIPVERSIONCHECKSโ bypasses some version checks. Unsafe, for compatibility testing only.OPAMSOLVERALLOWSUBOPTIMALโ (defaulttrue) lets some solvers still return a solution when they hit timeout; and while that solution stays assured to be consistent, there's no guarantee in this case that it fits the expected optimisation criteria. Iftrue, opam will continue with a warning; iffalse, a timeout is an error. Currently only thebuiltin-z3backend handles this degraded case.OPAMSOLVERTIMEOUTโ changes the time allowance of the solver. Default is60.0, and set it to0for unlimited. Note that not all solvers may support this option.OPAMSOLVERTOLERANCEโ changes the tolerance towards the solver choosing an unoptimized solution (i.e. it might pull outdated packages). Typical values range from0.0(best solution known to the solver) all the way to1.0(unoptimized solution). Default is0.0. This one's useful when the solver can't find a solution in a reasonable amount of time (see$OPAMSOLVERTIMEOUT). Note that all solvers may not support this option.OPAMSTATSโ Removed in 2.4.OPAMSTATUSLINEโ displays 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โ matches the option--switch'. Automatically set byopam env --switch=SWITCH --set-switch'`.OPAMUNLOCKBASEโ matches the install option `--unlock-base'.OPAMUPGRADECRITERIAโ your user preferences for dependency solving while performing an upgrade. It overridesOPAMCRITERIAin upgrades whenever both are set. See also the option--criteria.OPAMUSEINTERNALSOLVERโ matches the option `--use-internal-solver'.OPAMUSEOPENSSLโ Removed in 2.2.OPAMUTF8โ use UTF8 characters in output (one of always, never or auto). By default it'sauto, which gets determined from the locale ๐OPAMUTF8MSGSโ use extended UTF8 characters (camels ๐ช) in opam messages. It impliesOPAMUTF8. This is set by default on macOS only.OPAMVALIDATIONHOOKโ if set, uses the%{hook}%command to validate an opam repository update.OPAMVERBOSEโ matches the option `--verbose'.OPAMVERBOSEONโ matches the option--verbose-on.OPAMVERSIONLAGPOWERโ do not use. not a drill, just don't ๐OPAMWITHDEVSETUPโ matches the install option `--with-dev-setup'.OPAMWITHDOCโ matches the install option `--with-doc'.OPAMWITHTESTโ matches the install option--with-test.OPAMWORKINGDIRโ matches the option `--working-dir'.OPAMYESโ matches the options--yes' and--confirm-level.OPAMYEShas priority overOPAMNOand it gets ignored ifOPAMCONFIRMLEVEL` is set.OPAMVAR_varโ overrides the contents of the variablevarwhen substituting%{var}%strings inopamfiles.OPAMVAR_package_varโ overrides the contents of the variablepackage:varwhen substituting%{package:var}%strings inopamfiles.
๐ CLI VERSION ๐
okay so bestie, listen โ all your scripts and programmatic invocations of opam should be using --cli. Not optional, not a suggestion, it's the move โจ. Why? Because it makes sure they keep working seamlessly with future versions of the opam client. And bonus: blog posts and other documentation benefit too, since it stops the info from going stale. obsessed with the foresight ngl.
So even though opam only supports roots (~/.opam/) for the current version, it does provide backwards compatibility for its command-line interface. iconic behaviour honestly ๐
Here's the thing though โ CLI version support was only added in opam 2.1. So if you want 2.0 support, use OPAMCLI (since opam 2.0 will just ignore it, no drama), and for 2.1 (or later) versions, use --cli=2.1. Because lowkey, an environment variable that controls the parsing of syntax is brittle. To this end, opam displays a warning if OPAMCLI specifies a valid version other than 2.0, and it also warns if --cli=2.0 is specified. ๐ซถ
So how do you pick the command-line version? You use the --cli option, or the OPAMCLI environment variable. And heads up: --cli may be specified more than once, and in that case the last instance takes precedence. OPAMCLI only gets inspected if --cli is not given, periodt.
๐ EXIT STATUS ๐
okay bestie, here's the tea on how this thing tells you what happened when it's done. ๐
One exception first, and it's a big one: the exec command breaks the pattern. It returns 127 if the command was not found or couldn't be executed, and otherwise it returns the command's own exit value. So if you're script-checking exec, don't be surprised. ๐
0โ Success โจ (ortrue, for boolean queries).1โ False. You get this when a boolean return value is expected, like when you're running with--check, or for queries likeopam lint.2โ Bad command-line arguments, or arguments that point at an invalid context (like a file that doesn't follow the expected format). That's a you-typed-it-wrong situation fr.5โ Not found. You asked for something (package, version, repository, etc.) that justโฆ doesn't exist. It's giving ghosted. ๐ป10โ Aborted. The operation needed confirmation and you didn't give it. No consent, no command.15โ Could not acquire the locks required for the operation. Somebody else is holding the vibe hostage. ๐20โ There is no solution to the user request. Classic cause: asking to install two incompatible packages. Math said no. ๐งฎ30โ Error in package definition, or other metadata files. And heads up: using--strictraises this error more often. โ ๏ธ31โ Package script error. Some package operations were unsuccessful. Could be a bug in the packages, could be an incompatibility with your system โ and it 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 needs fixing. โ60โ Solver failure. The solver failed to return a sound answer. Maybe a broken external solver, maybe an error in solver configuration. It really said "idk." ๐99โ Internal error. Something went wrong, likely due to a bug in opam itself. Not you, bestie, it's them. ๐130โ User interrupt.SIGINTwas received, generally because the user pressed Ctrl+C. That was you. That was literally you. ๐ซถ
and then there's this second little crew of codes that shows up too:
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 โ that's the homework, bestie, go read it. ๐
๐ AUTHORS ๐
Look at this lineup. Absolute icons, every single one of them. ๐ซถ
- 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>
and more legends:
- 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) โ iykyk, it's the whole family. ๐
๐ BUGS ๐
Check bug reports at https://github.com/ocaml/opam/issues. Found something cursed? Tell them, don't suffer in silence. ๐
and that's the whole page, bestie!! ๐ this was Opam admin version 2.6.1, of the OPAM ADMIN-...E-EXTRAFILES(1) manual page โ go forth and administer your opam, you absolute main character. slay โจ๐ฆ๐ธ
๐ฆ 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