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 into DIR/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 ๐Ÿ”
  • -p PACKAGES, --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 of aspcud or mccs should). 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. It's 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. 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. ๐Ÿ’€
  • --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 `` โ€” 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, $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. ๐Ÿ“š
  • --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. ๐Ÿ”
  • --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 (--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, either manually through opam pin or through opam install DIR. This is equivalent to setting IGNOREPINDEPENDS=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 $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. 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 using opam admin upgrade [--mirror URL] when possible. ๐Ÿ“ฆ
  • -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. 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. 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 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. ๐Ÿง 
  • --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 โ€” 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). This is equivalent to setting $OPAMNOASPCUD or $OPAMUSEINTERNALSOLVER. ๐Ÿ 
  • -v, --verbose โ€” be more verbose. One -v shows all package commands, and repeating it also displays 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 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 $OPAMYES to "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 the opam-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 to always or never and it sets a default value for the `--color' option.
  • OPAMCONFIRMLEVEL โ€” matches the option --confirm-level. Heads up: OPAMCONFIRMLEVEL outranks both OPAMYES and OPAMNO.
  • OPAMCRITERIA โ€” your โœจpersonal vibeโœจ for dependency solving, aka user preference. The default value depends on the solver version, so run config report' to find out what's currently set. Also peep the option --criteria`.
  • OPAMCUDFFILE โ€” saves the cudf graph out to the file file-actions-explicit.dot.
  • OPAMCUDFTRIM โ€” controls how unrelated packages get filtered out during CUDF preprocessing.
  • OPAMCURL โ€” lets you pick which curl program gets used. See OPAMFETCH for 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 (like CLIENT:2 or CLIENT 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-dir on 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 $EDITOR and $VISUAL. yes it's that bossy ๐Ÿ‘‘
  • OPAMERRLOGLEN โ€” sets how many log lines get printed when a sub-process fails. Set it to 0 to print literally all of them.
  • OPAMEXTERNALSOLVER โ€” matches the option `--solver'.
  • OPAMFAKE โ€” matches the option `--fake'.
  • OPAMFETCH โ€” tells opam how to download files: either wget, curl, or a custom command where the variables %{url}%, %{out}%, %{retry}%, %{compress}% and %{checksum}% all get replaced. This overrides the download-command value from the main config file.
  • OPAMFIXUPCRITERIA โ€” same energy as OPAMUPGRADECRITERIA, 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 system make command to use.
  • OPAMMERGEOUT โ€” merges process outputs, with stderr landing on stdout.
  • OPAMNO โ€” answers no to any question asked, see the options --no and --confirm-level. OPAMNO gets ignored if either OPAMCONFIRMLEVEL or OPAMYES is 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-checksums whenever 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 to false to disable CUDF preprocessing. It's less efficient, but it might help you debug a solver issue.
  • OPAMREPOSITORYTARRING โ€” internally stores 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, 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 by opam 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 โ€” (default true) 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. 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 โ€” changes the time allowance of the solver. Default is 60.0, and set it to 0 for 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 from 0.0 (best solution known to the solver) all the way to 1.0 (unoptimized solution). Default is 0.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 by opam env --switch=SWITCH --set-switch'`.
  • OPAMUNLOCKBASE โ€” matches the install option `--unlock-base'.
  • OPAMUPGRADECRITERIA โ€” your user preferences for dependency solving while performing an upgrade. It overrides OPAMCRITERIA in 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's auto, which gets determined from the locale ๐Ÿ’…
  • OPAMUTF8MSGS โ€” use extended UTF8 characters (camels ๐Ÿช) in opam messages. It implies OPAMUTF8. 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 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 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 โœจ (or true, 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 like opam 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 --strict raises 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. SIGINT was 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