[opam-devel] What context do install an remove run in?

Malcolm Matalka mmatalka at gmail.com
Mon Sep 7 22:32:23 BST 2015


Anil Madhavapeddy <anil at recoil.org> writes:

> On 6 Sep 2015, at 19:49, Malcolm Matalka <mmatalka at gmail.com> wrote:
>> 
>> This is unclear to be from the documentation, but what context to the
>> commands `install` and `remove` sections of an opam file run in?  I
>> would assume `install` runs in the directory of the built source, but
>> does `remove` have that same guarantee?  Would that also mean that the
>> built source is kept around with the package?  I ask because I would
>> like to simplify my opam files by having a 'make remove' entry.
>
> They run in an unpacked source tree as the pwd.  However, this is not
> cached across build runs -- instead, the source is freshly unpacked and
> made available to the remove target.  So you just need to make sure
> that you run the `configure` script if relevant.
>
> There's a special case for `ocamlfind remove` that doesn't do this;
> this will likely have to be generalised as OPAM moves the OCaml-specific
> logic into a separate plugin.

Can I tell opam to figure this out via ocamlfind on its own or do is the
special case just checking if the command is "ocamlfind remove ..."?
Basically, I'm trying to make all of my opam files almost exactly the
same, except for deps, and push the unique actions into the package
itself, like install and remove.  The hope is to simplify making opam
packages of my tools.

>
> -anil


More information about the opam-devel mailing list