Thicket data repository for the EEG
1{
2 "id": "https://anil.recoil.org/notes/ocaml-github-and-opam",
3 "title": "Easily OPAM switching to any OCaml feature request",
4 "link": "https://anil.recoil.org/notes/ocaml-github-and-opam",
5 "updated": "2014-03-25T00:00:00",
6 "published": "2014-03-25T00:00:00",
7 "summary": "<p>Gabriel Scherer <a href=\"http://gallium.inria.fr/blog/patch-review-on-github/\">announced an\nexperiment</a> to\nhost OCaml compiler pull requests on\n<a href=\"https://github.com/ocaml/ocaml/pulls\">GitHub</a> for six months. There is\na general feeling that GitHub would be a more modern hosting platform\nthan the venerable but reliable\n<a href=\"http://caml.inria.fr/mantis/changelog_page.php\">Mantis</a> setup that has\nin place for over a decade, but the only way to find out for sure is by\ntrying it out for a while.</p>\n<p>One of the great benefits of using GitHub is their excellent\n<a href=\"http://developer.github.com/v3/\">API</a> to easily automate workflows\naround issues and pull requests. After a suggestion from Jeremy Yallop\nand David Sheets over lunch, I decided to use this to make it easier to\nlocally apply compiler patches. OPAM has a great <a href=\"https://opam.ocaml.org/doc/Advanced_Usage.html#h2-Usingadifferentcompiler\">compiler\nswitch</a>\nfeature that lets you run simultaneous OCaml installations and swap\nbetween them easily.</p>\n<p>For instance, the default setting gives you access\nto:</p>\n<pre><code>$ opam switch\nsystem C system System compiler (4.01.0)\n-- -- 3.11.2 Official 3.11.2 release\n-- -- 3.12.1 Official 3.12.1 release\n-- -- 4.00.0 Official 4.00.0 release\n-- -- 4.00.1 Official 4.00.1 release\n-- -- 4.01.0 Official 4.01.0 release\n-- -- 4.01.0beta1 Beta1 release of 4.01.0\n</code></pre>\n<p>I used my <a href=\"https://github.com/avsm/ocaml-github\">GitHub API bindings</a> to\nknock up a script that converts every GitHub pull request into a custom\ncompiler switch. You can see these by passing the <code>--all</code> option to\n<code>opam switch</code>, as follows:</p>\n<pre><code>$ opam switch --all\n-- -- 4.02.0dev+pr10 Add String.{split,rsplit}\n-- -- 4.02.0dev+pr13 Add String.{cut,rcut}.\n-- -- 4.02.0dev+pr14 Add absolute directory names to bytecode format for ocamldebug to use\n-- -- 4.02.0dev+pr15 replace String.blit by String.unsafe_blit\n-- -- 4.02.0dev+pr17 Cmm arithmetic optimisations\n-- -- 4.02.0dev+pr18 Patch for issue 5584\n-- -- 4.02.0dev+pr2 Parse -.x**2. (unary -.) as -.(x**2.). Fix PR#3414\n-- -- 4.02.0dev+pr20 OCamlbuild: Fix the check of ocamlfind\n-- -- 4.02.0dev+pr3 Extend record punning to allow destructuring.\n-- -- 4.02.0dev+pr4 Fix for PR#4832 (Filling bigarrays may block out runtime)\n-- -- 4.02.0dev+pr6 Warn user when a type variable in a type constraint has been instantiated.\n-- -- 4.02.0dev+pr7 Extend ocamllex with actions before refilling\n-- -- 4.02.0dev+pr8 Adds a .gitignore to ignore all generated files during `make world.opt'\n-- -- 4.02.0dev+pr9 FreeBSD 10 uses clang by default, with gcc not available by default\n-- -- 4.02.0dev+trunk latest trunk snapshot\n</code></pre>\n<p>Testing the impact of a particular compiler switch is now pretty\nstraightforward. If you want to play with Stephen Dolan\u2019s <a href=\"https://github.com/ocaml/ocaml/pull/17\">optimized\narithmetic operations</a>, for\ninstance, you just need to do:</p>\n<pre><code>$ opam switch 4.02.0dev+pr17\n$ eval `opam config env`\n</code></pre>\n<p>And your local environment now points to the patched OCaml compiler. For\nthe curious, the scripts to generate the OPAM pull requests are in my\n<a href=\"https://github.com/avsm/opam-sync-github-prs\">avsm/opam-sync-github-prs</a>\nrepository. It contains an example of how to query active pull requests,\nand also to create a new cross-repository pull request (using the <a href=\"https://github.com/avsm/ocaml-github\">git\njar</a> binary from my GitHub\nbindings). The scripts run daily for now, and delete switches once the\ncorresponding pull request is closed. Just run <code>opam update</code> to retrieve\nthe latest switch set from the upstream <a href=\"https://github.com/ocaml/opam-repository\">OPAM package\nrepository</a>.</p>",
8 "content": "<p>Gabriel Scherer <a href=\"http://gallium.inria.fr/blog/patch-review-on-github/\">announced an\nexperiment</a> to\nhost OCaml compiler pull requests on\n<a href=\"https://github.com/ocaml/ocaml/pulls\">GitHub</a> for six months. There is\na general feeling that GitHub would be a more modern hosting platform\nthan the venerable but reliable\n<a href=\"http://caml.inria.fr/mantis/changelog_page.php\">Mantis</a> setup that has\nin place for over a decade, but the only way to find out for sure is by\ntrying it out for a while.</p>\n<p>One of the great benefits of using GitHub is their excellent\n<a href=\"http://developer.github.com/v3/\">API</a> to easily automate workflows\naround issues and pull requests. After a suggestion from Jeremy Yallop\nand David Sheets over lunch, I decided to use this to make it easier to\nlocally apply compiler patches. OPAM has a great <a href=\"https://opam.ocaml.org/doc/Advanced_Usage.html#h2-Usingadifferentcompiler\">compiler\nswitch</a>\nfeature that lets you run simultaneous OCaml installations and swap\nbetween them easily.</p>\n<p>For instance, the default setting gives you access\nto:</p>\n<pre><code>$ opam switch\nsystem C system System compiler (4.01.0)\n-- -- 3.11.2 Official 3.11.2 release\n-- -- 3.12.1 Official 3.12.1 release\n-- -- 4.00.0 Official 4.00.0 release\n-- -- 4.00.1 Official 4.00.1 release\n-- -- 4.01.0 Official 4.01.0 release\n-- -- 4.01.0beta1 Beta1 release of 4.01.0\n</code></pre>\n<p>I used my <a href=\"https://github.com/avsm/ocaml-github\">GitHub API bindings</a> to\nknock up a script that converts every GitHub pull request into a custom\ncompiler switch. You can see these by passing the <code>--all</code> option to\n<code>opam switch</code>, as follows:</p>\n<pre><code>$ opam switch --all\n-- -- 4.02.0dev+pr10 Add String.{split,rsplit}\n-- -- 4.02.0dev+pr13 Add String.{cut,rcut}.\n-- -- 4.02.0dev+pr14 Add absolute directory names to bytecode format for ocamldebug to use\n-- -- 4.02.0dev+pr15 replace String.blit by String.unsafe_blit\n-- -- 4.02.0dev+pr17 Cmm arithmetic optimisations\n-- -- 4.02.0dev+pr18 Patch for issue 5584\n-- -- 4.02.0dev+pr2 Parse -.x**2. (unary -.) as -.(x**2.). Fix PR#3414\n-- -- 4.02.0dev+pr20 OCamlbuild: Fix the check of ocamlfind\n-- -- 4.02.0dev+pr3 Extend record punning to allow destructuring.\n-- -- 4.02.0dev+pr4 Fix for PR#4832 (Filling bigarrays may block out runtime)\n-- -- 4.02.0dev+pr6 Warn user when a type variable in a type constraint has been instantiated.\n-- -- 4.02.0dev+pr7 Extend ocamllex with actions before refilling\n-- -- 4.02.0dev+pr8 Adds a .gitignore to ignore all generated files during `make world.opt'\n-- -- 4.02.0dev+pr9 FreeBSD 10 uses clang by default, with gcc not available by default\n-- -- 4.02.0dev+trunk latest trunk snapshot\n</code></pre>\n<p>Testing the impact of a particular compiler switch is now pretty\nstraightforward. If you want to play with Stephen Dolan\u2019s <a href=\"https://github.com/ocaml/ocaml/pull/17\">optimized\narithmetic operations</a>, for\ninstance, you just need to do:</p>\n<pre><code>$ opam switch 4.02.0dev+pr17\n$ eval `opam config env`\n</code></pre>\n<p>And your local environment now points to the patched OCaml compiler. For\nthe curious, the scripts to generate the OPAM pull requests are in my\n<a href=\"https://github.com/avsm/opam-sync-github-prs\">avsm/opam-sync-github-prs</a>\nrepository. It contains an example of how to query active pull requests,\nand also to create a new cross-repository pull request (using the <a href=\"https://github.com/avsm/ocaml-github\">git\njar</a> binary from my GitHub\nbindings). The scripts run daily for now, and delete switches once the\ncorresponding pull request is closed. Just run <code>opam update</code> to retrieve\nthe latest switch set from the upstream <a href=\"https://github.com/ocaml/opam-repository\">OPAM package\nrepository</a>.</p>",
9 "content_type": "html",
10 "author": {
11 "name": "Anil Madhavapeddy",
12 "email": "anil@recoil.org",
13 "uri": "https://anil.recoil.org"
14 },
15 "categories": [],
16 "rights": "(c) 1998-2025 Anil Madhavapeddy, all rights reserved",
17 "source": "https://anil.recoil.org/news.xml"
18}