Re: opam packaging

"Ashish Agarwal [email protected] [ocaml_beginners]" <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <CAMu2m2LvUA290aZr1RmtNcUD4rv7hf1ejSxvC-W2kZKdX-PP7w@mail.gmail.com>
On Thu, Nov 26, 2015 at 4:32 PM, Hendrik Boom [email protected]
[ocaml_beginners] <[email protected]> wrote:

> Is this the right forum for questions like this?
>
Sure, although there is also the opam-devel list that could be used:
http://lists.ocaml.org/listinfo/opam-devel

I do want to avoid confusion between mine and the official opam
> packages of the same name.
>
You can do `opam repo priority`. Setting a higher priority to a repo gives
it higher precedence. See:
http://opam.ocaml.org/doc/Manual.html#Metadataprecedence


> Perhaps all this is clearly discussed in documentatino somewhere. If so
> I'd appreciate pointers to said documentation.
>

See the "documentation" link from opam.ocaml.org, but in my experience the
manual is out-of-date or missing many features.

(1) Where do I find the actual packages -- source and metadata in the
> .opam directory? Presumably once I have this, it will be clearer hos to
> proceed.
>
If I understand what you're trying to do correctly, you shouldn't need to
know this. You just need to create another repository, and add it with
`opam repo add`. In general, you shouldn't manually modify anything under
your .opam directory.

(2) What naming conventions are there to distinguish different versions
> of a package so that specific ones are picked up by programs like
> ocamlfind and ocamlbuild?
>
Note there is no connection between an opam package name, an ocamlfind
package name, and an OCaml library name. Usually, they are of course
somewhat similar, but there's nothing to enforce that.

You specifically mention "different versions of a package". With OPAM, you
can only install multiple versions of the same package by putting them in
different switches. Then when you do an `opam switch`, there is no choice
about which version ocamlfind or ocamlbuild will pick since within a switch
there is only one version visible.

(3) Once I do have package source code and have edited it
>
Again, if I'm understanding your goals correctly, you shouldn't be
modifying a packages source code, only its opam metadata.


> what do I have to do to build the package from it?
>
If you've got the opam metadata set up, you just do `opam install` like
usual. Note OPAM doesn't control the build process at all, except to simply
call whatever build commands it is told to.


> How do I register it with opam
> (locally, I'm long way from submitting anything to the public shared
> package library)?
>
You just create your own repo and add it with `opam repo add`. Registering
a package just means there is info about it in one or more of the repos
you've pointed your opam to. Do `opam repo` to see the list.

(4) Do I even have to build the package
>
Not sure at which step you mean. You don't have to build the package to set
it up with opam. You only tell opam where the tarball is and how to build
it. It is actually built only when you do `opam install`, i.e. opam
currently only supports source builds. You cannot distribute compiled
binaries with opam.


> and register it with opam to start using it?
>
There is no such thing as registering a package with "opam", only adding a
package to a repository that you have in your list of repos.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.