Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Towards a bridge with ocamlfind #1361

Merged
merged 8 commits into from
Apr 29, 2014
Merged

Towards a bridge with ocamlfind #1361

merged 8 commits into from
Apr 29, 2014

Conversation

samoht
Copy link
Member

@samoht samoht commented Apr 24, 2014

This series of patches completely removes the support for custom compilation options which were in OPAM since its beginning. This feature was complex and useless, and I'm sure nobody will miss it. Now we have a clean and clear semantics: every package can defined a <pkg>.config file at this root, with global variables which can be read by other packages if necessary.

We can now use the library and syntax field which were here from the beginning, and start filling them with interesting findlib metadata. I've push an example of automatic extraction to opam-repository soon.

samoht added 7 commits April 24, 2014 17:38
No more subsections, only a list of variables.
To use it:

$ opam-admin lib --infer <pkg>

Currently, just look at the list of uninstall targets. Could be completed to look into the archive directly.
@dbuenzli
Copy link
Contributor

I think this fits very well with the declarative approach of topkg where instead of generating build systems, the build system always knows how to build everything but the package builder makes selective calls in the build system according to the environment. This feature will allow to easily enrich build environments.

I do however have the following comments.

  1. It seems that config files are in $SWITCH/config/$PKG.config which AFAIK is not a standard unix directory.
  2. The mechanism is divorced from the .install mechanism.

For me it seems that this will make it needlessly harder for supporting regular package system with opam packages. Other package system may not like the fact that things are installed in $PREFIX/config/ and opam-installer will not handle the installation of PKG.config which seems rather silly.

Therefore I would rather suggest that:

  1. A standard unix directory be chosen for the installation of $PKG.config. I would suggest either lib (ocamlfind-like) or etc (unix-like). That is opam will look into lib/$PKG/$PKG.config for the variables.
  2. Let the package's install procedure install the config file at that location by itself. That is specify the file in the right .install section (lib or etc as choosen in 1.) if you have such a file or let your build system copy the file at the right location if you don't.

@samoht
Copy link
Member Author

samoht commented Apr 24, 2014

Agreed with you Daniel. There's just one slightly annoying point: currently, opam relies a lot on config/global-config.config for global variables. Not sure it's a good idea to move it, I don't know where, and we should handle OPAM upgrade gracefully.

@samoht
Copy link
Member Author

samoht commented Apr 24, 2014

don't merge yet, seems that the opam-admin script is not working properly yet.

@dbuenzli
Copy link
Contributor

Well you can leave that one for opam, it wouldn't be used by other package managers anyway. But the config for packages shouldn't be there.

@samoht
Copy link
Member Author

samoht commented Apr 24, 2014

@dbuenzli so you reckon that opam config var <pkg>:<variable> should read in lib/<pkg>/<variable>.config ?

We could distribute an opam-variable binary to do the same thing than opam-installer to deal with reading configuration variable I guess.

@dbuenzli
Copy link
Contributor

Yes lib/<pkg>/<pkg>.config to be precise and yes having a tool to read that would be nice. Note that maybe rather than multiply the tools we could have a generic opam-pkg tool, that allows to 1) read fields from opam files (extracting metadata) 2) read fields from .install files and handle them as opam-installer does and 3) read fields from .config files.

@dbuenzli
Copy link
Contributor

Or maybe lib/<pkg>/opam.config would be even better, no need to repeat the package name again.

@samoht
Copy link
Member Author

samoht commented Apr 24, 2014

Good to merge now.

btw, with opam itselft you can already do 1)opam show <pkg> -f <field> and 3) opam config var <pkg>:<variable>. There is no easy way atm to read the .install files, which should be quite useful to have I guess.

And yes, providing opam-pkg to help non-opam users is interesting. But not very high on my priority list ...

@dbuenzli
Copy link
Contributor

Sure but opam show is a little bit different as it acts on packages in the repo. You'd want it to act on a concrete opam file (e.g. when you do distributions, though I wouldn't need it with my current workflow).

Regarding opam-pkg, I understand it's not on your priority list. But since I started to use the topkg approach (previously with shell scripts), I was asked more than once why I was not simply (sic) using oasis -- a funny question, the answers being so obvious. So I gently try to push to make sure there's good tooling that supports my approach for system packagers...

@AltGr
Copy link
Member

AltGr commented Apr 25, 2014

Awesome, thanks !
Did you check it didn't break opamfu / opam2web ?

AltGr added a commit that referenced this pull request Apr 29, 2014
Towards a bridge with ocamlfind
@AltGr AltGr merged commit 4c38703 into ocaml:master Apr 29, 2014
@samoht
Copy link
Member Author

samoht commented Apr 29, 2014

@AltGr I haven't checked, I think it will break opamfu/opam2web indeed. I'll try to fix that later this week (and move the location of .config files as well).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants