1OPAM-REPOSITORY(1) Opam Manual OPAM-REPOSITORY(1)
2
3
4
6 opam-repository - Manage opam repositories.
7
9 opam repository [OPTION]... [COMMAND] [ARG]...
10
12 This command is used to manage package repositories. Repositories can
13 be registered through subcommands add, remove and set-url, and are
14 updated from their URLs using opam update. Their names are global for
15 all switches, and each switch has its own selection of repositories
16 where it gets package definitions from.
17
18 Main commands add, remove and set-repos act only on the current switch,
19 unless differently specified using options explained in SCOPE
20 SPECIFICATION OPTIONS.
21
22 Without a subcommand, or with the subcommand list, lists selected
23 repositories, or all configured repositories with --all.
24
26 Without argument, defaults to list.
27
28 add NAME [ADDRESS] [QUORUM] [FINGERPRINTS]
29 Adds under NAME the repository at address ADDRESS to the list of
30 configured repositories, if not already registered, and sets this
31 repository for use in the current switch (or the specified scope).
32 ADDRESS is required if the repository name is not already
33 registered, and is otherwise an error if different from the
34 registered address. The quorum is a positive integer that
35 determines the validation threshold for signed repositories, with
36 fingerprints the trust anchors for said validation.
37
38 Note: By default, the repository is only added to the current
39 switch. To add a repository to other switches, you need to use the
40 --all or --set-default options (see below). If you want to enable a
41 repository only to install its switches, you may be looking for
42 opam switch create --repositories=REPOS.
43
44 remove NAME...
45 Unselects the given repositories so that they will not be used to
46 get package definitions anymore. With --all, makes opam forget
47 about these repositories completely.
48
49 set-repos NAME...
50 Explicitly selects the list of repositories to look up package
51 definitions from, in the specified priority order (overriding
52 previous selection and ranks), according to the specified scope.
53
54 set-url NAME ADDRESS [QUORUM] [FINGERPRINTS]
55 Updates the URL and trust anchors associated with a given
56 repository name. Note that if you don't specify [QUORUM] and
57 [FINGERPRINTS], any previous settings will be erased.
58
59 list
60 Lists the currently selected repositories in priority order from
61 rank 1. With --all, lists all configured repositories and the
62 switches where they are active.
63
64 priority NAME RANK
65 Synonym to add NAME --rank RANK
66
68 These flags allow one to choose which selections are changed by add,
69 remove, set-repos. If no flag in this section is specified the updated
70 selections default to the current switch. Multiple scopes can be
71 selected, e.g. --this-switch --set-default.
72
73 -a, --all-switches
74 Act on the selections of all configured switches
75
76 --dont-select
77 Don't update any selections
78
79 --on-switches=SWITCHES
80 Act on the selections of the given list of switches
81
82 --set-default
83 Act on the default repository selection that is used for newly
84 created switches
85
86 --this-switch
87 Act on the selections for the current switch (this is the default)
88
90 -k KIND, --kind=KIND
91 Specify the kind of the repository to be used (one of `http',
92 `local', `git', `darcs' or `hg').
93
94 --no
95 Answer no to all opam yes/no questions without prompting. See also
96 --confirm-level. This is equivalent to setting $OPAMNO to "true".
97
98 --rank=RANK (absent=1)
99 Set the rank of the repository in the list of configured
100 repositories. Package definitions are looked in the repositories in
101 increasing rank order, therefore 1 is the highest priority.
102 Negative ints can be used to select from the lowest priority, -1
103 being last. set-repos can otherwise be used to explicitly set the
104 repository list at once.
105
106 -s, --short
107 Output raw lists of names, one per line, skipping any details.
108
109 -y, --yes
110 Answer yes to all opam yes/no questions without prompting. See also
111 --confirm-level. This is equivalent to setting $OPAMYES to "true".
112
114 These options are common to all commands.
115
116 --best-effort
117 Don't fail if all requested packages can't be installed: try to
118 install as many as possible. Note that not all external solvers may
119 support this option (recent versions of aspcud or mccs should).
120 This is equivalent to setting $OPAMBESTEFFORT environment variable.
121
122 --cli=MAJOR.MINOR (absent=2.1)
123 Use the command-line interface syntax and semantics of MAJOR.MINOR.
124 Intended for any persistent use of opam (scripts, blog posts,
125 etc.), any version of opam in the same MAJOR series will behave as
126 for the specified MINOR release. The flag was not available in opam
127 2.0, so to select the 2.0 CLI, set the OPAMCLI environment variable
128 to 2.0 instead of using this parameter.
129
130 --color=WHEN
131 Colorize the output. WHEN must be one of `always', `never' or
132 `auto'.
133
134 --confirm-level=LEVEL
135 Confirmation level, LEVEL must be one of `ask', `no', `yes' or
136 `unsafe-yes'. Can be specified more than once. If --yes or --no are
137 also given, the value of the last --confirm-level is taken into
138 account. This is equivalent to setting $OPAMCONFIRMLEVEL`.
139
140 --criteria=CRITERIA
141 Specify user preferences for dependency solving for this run.
142 Overrides both $OPAMCRITERIA and $OPAMUPGRADECRITERIA. For details
143 on the supported language, and the external solvers available, see
144 http://opam.ocaml.org/doc/External_solvers.html. A general guide to
145 using solver preferences can be found at
146 http://www.dicosmo.org/Articles/usercriteria.pdf.
147
148 --cudf=FILENAME
149 Debug option: Save the CUDF requests sent to the solver to
150 FILENAME-<n>.cudf.
151
152 --debug
153 Print debug message to stderr. This is equivalent to setting
154 $OPAMDEBUG to "true".
155
156 --debug-level=LEVEL
157 Like --debug, but allows specifying the debug level (--debug sets
158 it to 1). Equivalent to setting $OPAMDEBUG to a positive integer.
159
160 --git-version
161 Print the git version of opam, if set (i.e. you are using a
162 development version), and exit.
163
164 --help[=FMT] (default=auto)
165 Show this help in format FMT. The value FMT must be one of `auto',
166 `pager', `groff' or `plain'. With `auto', the format is `pager` or
167 `plain' whenever the TERM env var is `dumb' or undefined.
168
169 --ignore-pin-depends
170 Ignore extra pins required by packages that get pinned, either
171 manually through opam pin or through opam install DIR. This is
172 equivalent to setting IGNOREPINDEPENDS=true.
173
174 --json=FILENAME
175 Save the results of the opam run in a computer-readable file. If
176 the filename contains the character `%', it will be replaced by an
177 index that doesn't overwrite an existing file. Similar to setting
178 the $OPAMJSON variable.
179
180 --no-aspcud
181 Removed in 2.1.
182
183 --no-auto-upgrade
184 When configuring or updating a repository that is written for an
185 earlier opam version (1.2), opam internally converts it to the
186 current format. This disables this behaviour. Note that
187 repositories should define their format version in a 'repo' file at
188 their root, or they will be assumed to be in the older format. It
189 is, in any case, preferable to upgrade the repositories manually
190 using opam admin upgrade [--mirror URL] when possible.
191
192 --no-self-upgrade
193 Opam will replace itself with a newer binary found at OPAMROOT/opam
194 if present. This disables this behaviour.
195
196 -q, --quiet
197 Disables --verbose.
198
199 --root=ROOT
200 Use ROOT as the current root path. This is equivalent to setting
201 $OPAMROOT to ROOT.
202
203 --safe, --readonly
204 Make sure nothing will be automatically updated or rewritten.
205 Useful for calling from completion scripts, for example. Will fail
206 whenever such an operation is needed ; also avoids waiting for
207 locks, skips interactive questions and overrides the $OPAMDEBUG
208 variable. This is equivalent to set environment variable $OPAMSAFE.
209
210 --solver=CMD
211 Specify the CUDF solver to use for resolving package installation
212 problems. This is either a predefined solver (this version of opam
213 supports builtin-mccs+lp(), builtin-mccs+glpk,
214 builtin-dummy-z3-solver, builtin-dummy-0install-solver, aspcud,
215 mccs, aspcud-old, packup), or a custom command that should contain
216 the variables %{input}%, %{output}%, %{criteria}%, and optionally
217 %{timeout}%. This is equivalent to setting $OPAMEXTERNALSOLVER.
218
219 --strict
220 Fail whenever an error is found in a package definition or a
221 configuration file. The default is to continue silently if
222 possible.
223
224 --switch=SWITCH
225 Use SWITCH as the current compiler switch. This is equivalent to
226 setting $OPAMSWITCH to SWITCH.
227
228 --use-internal-solver
229 Disable any external solver, and use the built-in one (this
230 requires that opam has been compiled with a built-in solver). This
231 is equivalent to setting $OPAMNOASPCUD or $OPAMUSEINTERNALSOLVER.
232
233 -v, --verbose
234 Be more verbose. One -v shows all package commands, repeat to also
235 display commands called internally (e.g. tar, curl, patch etc.)
236 Repeating n times is equivalent to setting $OPAMVERBOSE to "n".
237
238 --version
239 Show version information.
240
241 -w, --working-dir
242 Whenever updating packages that are bound to a local,
243 version-controlled directory, update to the current working state
244 of their source instead of the last committed state, or the ref
245 they are pointing to. As source directory is copied as it is, if it
246 isn't clean it may result on a opam build failure.This only affects
247 packages explicitly listed on the command-line.It can also be set
248 with $OPAMWORKINGDIR.
249
251 Opam makes use of the environment variables listed here. Boolean
252 variables should be set to "0", "no", "false" or the empty string to
253 disable, "1", "yes" or "true" to enable.
254
255 OPAMALLPARENS surround all filters with parenthesis.
256
257 OPAMASSUMEDEPEXTS see option `--assume-depexts'.
258
259 OPAMAUTOREMOVE see remove option `--auto-remove'.
260
261 OPAMBESTEFFORT see option `--best-effort'.
262
263 OPAMBESTEFFORTPREFIXCRITERIA sets the string that must be prepended to
264 the criteria when the `--best-effort' option is set, and is expected to
265 maximise the `opam-query' property in the solution.
266
267 OPAMBUILDDOC Removed in 2.1.
268
269 OPAMBUILDTEST Removed in 2.1.
270
271 OPAMCLI see option `--cli'.
272
273 OPAMCOLOR when set to always or never, sets a default value for the
274 `--color' option.
275
276 OPAMCONFIRMLEVEL see option `--confirm-level`. OPAMCONFIRMLEVEL has
277 priority over OPAMYES and OPAMNO.
278
279 OPAMCRITERIA specifies user preferences for dependency solving. The
280 default value depends on the solver version, use `config report' to
281 know the current setting. See also option --criteria.
282
283 OPAMCUDFFILE save the cudf graph to file-actions-explicit.dot.
284
285 OPAMCUDFTRIM controls the filtering of unrelated packages during CUDF
286 preprocessing.
287
288 OPAMCURL can be used to select a given 'curl' program. See OPAMFETCH
289 for more options.
290
291 OPAMDEBUG see options `--debug' and `--debug-level'.
292
293 OPAMDEBUGSECTIONS if set, limits debug messages to the space-separated
294 list of sections. Sections can optionally have a specific debug level
295 (for example, CLIENT:2 or CLIENT CUDF:2), but otherwise use
296 `--debug-level'.
297
298 OPAMDIGDEPTH defines how aggressive the lookup for conflicts during
299 CUDF preprocessing is.
300
301 OPAMDOWNLOADJOBS sets the maximum number of simultaneous downloads.
302
303 OPAMDROPWORKINGDIR overrides packages previously updated with
304 --working-dir on update. Without this variable set, opam would keep
305 them unchanged unless explicitly named on the command-line.
306
307 OPAMDRYRUN see option `--dry-run'.
308
309 OPAMEDITOR sets the editor to use for opam file editing, overrides
310 $EDITOR and $VISUAL.
311
312 OPAMERRLOGLEN sets the number of log lines printed when a sub-process
313 fails. 0 to print all.
314
315 OPAMEXTERNALSOLVER see option `--solver'.
316
317 OPAMFAKE see option `--fake'.
318
319 OPAMFETCH specifies how to download files: either `wget', `curl' or a
320 custom command where variables %{url}%, %{out}%, %{retry}%,
321 %{compress}% and %{checksum}% will be replaced. Overrides the
322 'download-command' value from the main config file.
323
324 OPAMFIXUPCRITERIA same as OPAMUPGRADECRITERIA, but specific to fixup.
325
326 OPAMIGNORECONSTRAINTS see install option `--ignore-constraints-on'.
327
328 OPAMIGNOREPINDEPENDS see option `--ignore-pin-depends'.
329
330 OPAMINPLACEBUILD see option `--inplace-build'.
331
332 OPAMJOBS sets the maximum number of parallel workers to run.
333
334 OPAMJSON log json output to the given file (use character `%' to index
335 the files).
336
337 OPAMKEEPBUILDDIR see install option `--keep-build-dir'.
338
339 OPAMKEEPLOGS tells opam to not remove some temporary command logs and
340 some backups. This skips some finalisers and may also help to get more
341 reliable backtraces.
342
343 OPAMLOCKED combination of `--locked' and `--lock-suffix' options.
344
345 OPAMLOGS logdir sets log directory, default is a temporary directory in
346 /tmp
347
348 OPAMMAKECMD set the system make command to use.
349
350 OPAMMERGEOUT merge process outputs, stderr on stdout.
351
352 OPAMNO answer no to any question asked, see options `--no` and
353 `--confirm-level`. OPAMNO is ignored if either OPAMCONFIRMLEVEL or
354 OPAMYES is set.
355
356 OPAMNOAGGREGATE with `opam admin check', don't aggregate packages.
357
358 OPAMNOASPCUD Deprecated.
359
360 OPAMNOAUTOUPGRADE disables automatic internal upgrade of repositories
361 in an earlier format to the current one, on 'update' or 'init'.
362
363 OPAMNOCHECKSUMS enables option --no-checksums when available.
364
365 OPAMNODEPEXTS disables system dependencies handling, see option
366 `--no-depexts'.
367
368 OPAMNOENVNOTICE Internal.
369
370 OPAMNOSELFUPGRADE see option `--no-self-upgrade'
371
372 OPAMPINKINDAUTO sets whether version control systems should be detected
373 when pinning to a local path. Enabled by default since 1.3.0.
374
375 OPAMPRECISETRACKING fine grain tracking of directories.
376
377 OPAMPREPRO set this to false to disable CUDF preprocessing. Less
378 efficient, but might help debugging solver issue.
379
380 OPAMREQUIRECHECKSUMS Enables option `--require-checksums' when
381 available (e.g. for `opam install').
382
383 OPAMRETRIES sets the number of tries before failing downloads.
384
385 OPAMREUSEBUILDDIR see option `--reuse-build-dir'.
386
387 OPAMROOT see option `--root'. This is automatically set by `opam env
388 --root=DIR --set-root'.
389
390 OPAMROOTISOK don't complain when running as root.
391
392 OPAMSAFE see option `--safe'.
393
394 OPAMSHOW see option `--show'.
395
396 OPAMSKIPUPDATE see option `--skip-updates'.
397
398 OPAMSKIPVERSIONCHECKS bypasses some version checks. Unsafe, for
399 compatibility testing only.
400
401 OPAMSOLVERALLOWSUBOPTIMAL (default `true') allows some solvers to still
402 return a solution when they reach timeout; while the solution remains
403 assured to be consistent, there is no guarantee in this case that it
404 fits the expected optimisation criteria. If `true', opam willcontinue
405 with a warning, if `false' a timeout is an error. Currently only the
406 builtin-z3 backend handles this degraded case.
407
408 OPAMSOLVERTIMEOUT change the time allowance of the solver. Default is
409 60.0, set to 0 for unlimited. Note that all solvers may not support
410 this option.
411
412 OPAMSTATS display stats at the end of command.
413
414 OPAMSTATUSLINE display a dynamic status line showing what's currently
415 going on on the terminal. (one of one of `always', `never' or `auto')
416
417 OPAMSTRICT fail on inconsistencies (file reading, switch import, etc.).
418
419 OPAMSWITCH see option `--switch'. Automatically set by `opam env
420 --switch=SWITCH --set-switch'.
421
422 OPAMUNLOCKBASE see install option `--unlock-base'.
423
424 OPAMUPGRADECRITERIA specifies user preferences for dependency solving
425 when performing an upgrade. Overrides OPAMCRITERIA in upgrades if both
426 are set. See also option --criteria.
427
428 OPAMUSEINTERNALSOLVER see option `--use-internal-solver'.
429
430 OPAMUSEOPENSSL force openssl use for hash computing.
431
432 OPAMUTF8 use UTF8 characters in output (one of one of `always', `never'
433 or `auto'). By default `auto', which is determined from the locale).
434
435 OPAMUTF8MSGS use extended UTF8 characters (camels) in opam messages.
436 Implies OPAMUTF8. This is set by default on OSX only.
437
438 OPAMVALIDATIONHOOK if set, uses the `%{hook%}' command to validate an
439 opam repository update.
440
441 OPAMVERBOSE see option `--verbose'.
442
443 OPAMVERSIONLAGPOWER do not use.
444
445 OPAMWITHDOC see install option `--with-doc'.
446
447 OPAMWITHTEST see install option `--with-test.
448
449 OPAMWORKINGDIR see option `--working-dir'.
450
451 OPAMYES see options `--yes' and `--confirm-level`. OPAMYES has has
452 priority over OPAMNO and is ignored if OPAMCONFIRMLEVEL is set.
453
454 OPAMVAR_var overrides the contents of the variable var when
455 substituting `%{var}%` strings in `opam` files.
456
457 OPAMVAR_package_var overrides the contents of the variable package:var
458 when substituting `%{package:var}%` strings in `opam` files.
459
461 All scripts and programmatic invocations of opam should use `--cli' in
462 order to ensure that they work seamlessly with future versions of the
463 opam client. Additionally, blog posts or other documentation can
464 benefit, as it prevents information from becoming stale.
465
466 Although opam only supports roots (~/.opam/) for the current version,
467 it does provide backwards compatibility for its command-line interface.
468
469 Since CLI version support was only added in opam 2.1, use OPAMCLI to
470 select 2.0 support (as opam 2.0 will just ignore it), and `--cli=2.1'
471 for 2.1 (or later) versions, since an environment variable controlling
472 the parsing of syntax is brittle. To this end, opam displays a warning
473 if OPAMCLI specifies a valid version other than 2.0, and also if
474 `--cli=2.0' is specified.
475
476 The command-line version is selected by using the `--cli' option or the
477 OPAMCLI environment variable. `--cli' may be specified morethan once,
478 where the last instance takes precedence. OPAMCLI is only inspected if
479 `--cli' is not given.
480
482 As an exception to the following, the `exec' command returns 127 if the
483 command was not found or couldn't be executed, and the command's exit
484 value otherwise.
485
486 0 Success, or true for boolean queries.
487
488 1 False. Returned when a boolean return value is expected, e.g. when
489 running with --check, or for queries like opam lint.
490
491 2 Bad command-line arguments, or command-line arguments pointing to
492 an invalid context (e.g. file not following the expected format).
493
494 5 Not found. You requested something (package, version, repository,
495 etc.) that couldn't be found.
496
497 10 Aborted. The operation required confirmation, which wasn't given.
498
499 15 Could not acquire the locks required for the operation.
500
501 20 There is no solution to the user request. This can be caused by
502 asking to install two incompatible packages, for example.
503
504 30 Error in package definition, or other metadata files. Using
505 --strict raises this error more often.
506
507 31 Package script error. Some package operations were unsuccessful.
508 This may be an error in the packages or an incompatibility with
509 your system. This can be a partial error.
510
511 40 Sync error. Could not fetch some remotes from the network. This can
512 be a partial error.
513
514 50 Configuration error. Opam or system configuration doesn't allow
515 operation, and needs fixing.
516
517 60 Solver failure. The solver failed to return a sound answer. It can
518 be due to a broken external solver, or an error in solver
519 configuration.
520
521 99 Internal error. Something went wrong, likely due to a bug in opam
522 itself.
523
524 130 User interrupt. SIGINT was received, generally due to the user
525 pressing Ctrl-C.
526
528 See https://opam.ocaml.org/doc.
529
531 Vincent Bernardoff <vb@luminar.eu.org>
532 Raja Boujbel <raja.boujbel@ocamlpro.com>
533 Roberto Di Cosmo <roberto@dicosmo.org>
534 Thomas Gazagnaire <thomas@gazagnaire.org>
535 Louis Gesbert <louis.gesbert@ocamlpro.com>
536 Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
537 Anil Madhavapeddy <anil@recoil.org>
538 Guillem Rieu <guillem.rieu@ocamlpro.com>
539 Ralf Treinen <ralf.treinen@pps.jussieu.fr>
540 Frederic Tuong <tuong@users.gforge.inria.fr>
541
543 Check bug reports at https://github.com/ocaml/opam/issues.
544
545
546
547Opam 2.1.2 OPAM-REPOSITORY(1)