[ocaml-platform] A small script for compiler hackers: create short-lived opam switches out of any git branch

Anil Madhavapeddy anil at recoil.org
Mon Mar 18 16:13:41 GMT 2013


On 17 Mar 2013, at 14:18, Wojciech Meyer <wojciech.meyer at gmail.com> wrote:

> Hi Gabriel,
> 
> all is needed for testing ocamlbuild and local patches for the compiler,
> thank you.
> 
> Other useful thing in general for OPAM would be something like:
> 
> opam patch add <ordered list_of_patches>
> opam patch reset
> 
> then we are able quickly test some local patches without touching
> command line and invoking makefiles.

Just to clarify this, are you asking for this for the compiler switches,
or for packages, or for both?

Local patches can be made to work with packages via `opam pin`, although
supporting a patch queue model may be useful in the future.

Compiler patches don't exist at the moment within OPAM, but I like Gabriel's
approach of taking an existing tree (that's, e.g., a git repo) and moving
it into the OPAM space.  You can just use the underlying VCS to track your
patches and branches without requiring more complexity in OPAM.

-anil



> 
> Gabriel Scherer <gabriel.scherer at gmail.com> writes:
> 
>> As part of the slowly-evolving benchmark work, I have developed a
>> script to turn any repository that quacks like an OCaml compiler and
>> can run "make world.opt" into an OPAM compiler switch.
>> 
>>  https://github.com/gasche/opam-compiler-conf
>> 
>> The intended use case is to change something, recompile what need be,
>> get a compiler switch for that, and install one or two packages for
>> testing something. You could envision, for example, OPAM being used in
>> the internal loop of a bisection process. In this case it is important
>> that OPAM does not recompile the compiler on its side (so the usual
>> technique of making a tarball of the compiler source and letting OPAM
>> do its job from there is not pleasant in that situation); the scripts
>> makes use of voodoo OPAM compiler options (thanks to Thomas in
>> https://github.com/OCamlPro/opam/pull/519 ) to have it just run "make
>> install" each time "opam switch reinstall" is called.
>> 
>> This is a quick&dirty shell script that works on my machine. No
>> guarantee that it will work on yours. It also assumes that the
>> version-control system (VCS) used is git, and calls "git branch" to
>> infer the name of the compiler switch to use. Eventual patches to
>> support other VCSs (or, for example, infer the switch name from the
>> directory name) would be welcome.
> _______________________________________________
> Platform mailing list
> Platform at lists.ocaml.org
> http://lists.ocaml.org/listinfo/platform
> 



More information about the Platform mailing list