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