Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install from a specific git branch with OPAM

Tags:

git

opam

I have a project, which offers different features in different git branches. I believe, this is mostly done to simplify external dependencies (that is someone who wants to work with sqlite will not depend on modules for mysql and so on). Unfortunately, the functionality I need does not reside in master.

Is there a way to tell OPAM to fetch the project from a specific branch when installing? If not how might it be possible to add such project into OPAM?

like image 733
everiq Avatar asked Aug 13 '14 03:08

everiq


People also ask

Where does opam install?

Your libraries are installed to the directory returned by opam var lib , which is by default ~/. opam/<switch>/lib .

How does opam switch work?

opam switch set sets the default switch globally. The shell hook, when enabled, synchronises the current shell session with this switch, unless the current directory is a local switch, when that local switch is used instead.

How do I change opam version?

Use opam switch <version> to switch to a different OCaml version, or opam switch <name> --alias-of <version> to name the new switch as you like. Don't forget to run the advertised eval $(opam config env) to update your PATH accordingly.


1 Answers

Use opam pin. Put the branch name after a #, e.g. to use my "checksum" branch of the OCaml tcpip library instead of the upstream one:

$ opam pin tcpip https://github.com/talex5/mirage-tcpip.git#checksum
like image 185
Thomas Leonard Avatar answered Nov 07 '22 02:11

Thomas Leonard