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