$ opam switch --dry-run create lts ocaml=4.14.2
<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Switch invariant: ["ocaml" {= "4.14.2"}]
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Installing base-bigarray.base.
∗ installed base-bigarray.base
Installing base-threads.base.
∗ installed base-threads.base
Installing base-unix.base.
∗ installed base-unix.base
Installing ocaml-options-vanilla.1.
∗ installed ocaml-options-vanilla.1
Installing ocaml-base-compiler.4.14.2.
∗ installed ocaml-base-compiler.4.14.2
Installing ocaml-config.2.
∗ installed ocaml-config.2
Installing ocaml.4.14.2.
∗ installed ocaml.4.14.2
Done.
# Run eval $(opam env --switch=lts) to update the current shell environment
$ opam switch --dry-run create lts ocaml=4.14.2
[ERROR] Directory "/home/username/.opam/lts" already exists, please choose a different name
~$ tree -a ~/.opam/lts
/home/username/.opam/lts
└── .opam-switch
├── build
├── install
│ ├── base-bigarray.changes
│ ├── base-threads.changes
│ ├── base-unix.changes
│ ├── ocaml-base-compiler.changes
│ ├── ocaml.changes
│ ├── ocaml-config.changes
│ └── ocaml-options-vanilla.changes
└── packages
└── cache
4 directories, 8 files
# opam config report
# opam-version 2.1.2
# self-upgrade no
# system arch=x86_64 os=linux os-distribution=ubuntu os-version=22.04
# solver builtin-mccs+glpk
# install-criteria -removed,-count[avoid-version,changed],-count[version-lag,request],-count[version-lag,changed],-count[missing-depexts,changed],-changed
# upgrade-criteria -removed,-count[avoid-version,changed],-count[version-lag,solution],-count[missing-depexts,changed],-new
# jobs 7
# repositories 1 (http), 1 (version-controlled) (default repo at b8624d2c)
# pinned 0
# current-switch dev2
# ocaml:native true
# ocaml:native-tools true
# ocaml:native-dynlink true
# ocaml:stubsdir /home/username/.opam/dev2/lib/ocaml/stublibs:/home/username/.opam/dev2/lib/ocaml
# ocaml:preinstalled false
# ocaml:compiler 5.1.1
Current behavior:
Expected behavior:
--dry-runcommands should not write to the filesystem at all outside opam's internal caches