-
Notifications
You must be signed in to change notification settings - Fork 366
How to test an opam feature
If the binary is present in the releases page, it can be installed
using the install.sh
script. If your opam root is not in the usual location ~/.opam
,
set the OPAMROOT
environment variable before calling it.
sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh) --dev --backup
To test a release other than the latest, change master
to the tag name.
The install script can restore the opam binary and root from a backup. The
previous version was given on the previous command, which can be found in the
backup directory of the form <opamroot>.<version>
.
sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh) --restore <version>
You can use your current opam binary. In order not to swamp your current switches, we will create a new one, install opam, and do a backup of your opam root.
$ opam sw cr test_opam --empty # or choose your preferred compiler
$ eval $(opam env)
$ opam pin git+https://github.com/ocaml/opam
$ cp <opamroot>/lib/opam-devel/opam <prefix>
$ chmod +x <prefix>/opam
$ cp -R <opamroot> <opamroot>.backup
If you don't want to use you current installed opam root, you can follow
opam-devel
's post-install message and make an alias with a fresh opam root.
$ alias opam2="OPAMROOT=~/.opam2 <opamroot>/lib/opam-devel/opam"
As for building from sources, but you need to pin the pull request branch.
$ opam pin git+https://github.com/ocaml/opam#pull/<PR_ID>/head
If your new opam root is no longer needed, you can recover the backup, and remove the newly created switch.
$ rm -r <opamroot>
$ cp -r <opamroot>.backup <opamroot>
$ opam switch remove test_opam