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

Louis Gesbert louis.gesbert at ocamlpro.com
Fri Sep 11 01:26:19 BST 2015


Note that this special treatment -- not getting the unpacked source -- is triggered:

- "magically" when the remove commands are detected to all be "ocamlfind remove", which is a hack, but also
- when there are no remove commands. This is reasonable when using a <pkg>.install file (http://opam.ocaml.org/doc/Manual.html#packagenameinstall)
- when the package definition specifies `flags: light-uninstall` (http://opam.ocaml.org/doc/Manual.html#opamflag-light-uninstall)

Best,
Louis

> - Thomas Gazagnaire, 08/09/2015 11:07 -
> >>> 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.
> 
> The easiest way to handle uninstall is to generate an <pkg.install> file. Otherwise, there is indeed a special syntactic treatment for "ocamlfind remove" commands (where the tarball is not downloaded and extracted again). If you really want to have a "make remove" command, as Anil said you should do "./configure --prefix=... && make remove"
> 
> Thomas
> 
> _______________________________________________
> opam-devel mailing list
> opam-devel at lists.ocaml.org
> http://lists.ocaml.org/listinfo/opam-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.ocaml.org/pipermail/opam-devel/attachments/20150911/c641c158/attachment.sig>


More information about the opam-devel mailing list