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