[RFC] No opam , version constraints for packages of unikernels #82
Conversation
opam output for mirage-console:
|
Woah, awesome! |
That's awesome, thanks for having a look at this. I am not totally convinced by the |
glad that you point out the weak bits:
|
this has been updated, and I think it is more or less good now... I don't know much about the pp in Functoria_app (and what it should print now, see comment), and also don't have a clue whether we need better errors (and in which way) instead of invalid_arg if the version number is not a list of numbers etc... I addressed @samoht concerns: (changed to feedback welcome! |
I really like generating random names for the opam files (when it is not provided by the user). I find it quite nice in docker. And I really want to have my |
instead of random, why not deterministic (hash over all the provided configuration keys?) |
I updated the mirage bits mirage/mirage#691, and mirage/mirage-skeleton#198 will not compile (unless using all these branches and rewriting the CI scripts slightly) |
eaa7a74
to
07d974a
is better now, still questions are open: what should |
@Drup I'm interested in your opinion here (and maybe you have answers to the 2 questions I raised in my previous comment). |
I like that work a lot, well done. I reviewed the changes and made various comments. I'm not extremely convinced by the usage of a String.Map for packages, but the implementation make sense, you probably want to add a quick comment in the ml file as to why it's done that way (to make merging of packages easy). As for your question about |
additional sublibraries (e.g. [~sublibs:["mirage"] "foo"] will result in the | ||
findlib names [ ["foo"; "foo.mirage"] ]. In case the findlib name is | ||
disjoint (or empty), use [~ocamlfind]. Version constraints are given as | ||
[min] (inclusive) and [max] (exclusive). *) |
Drup
Nov 21, 2016
Member
Please specify that using ocamlfind
with sublib
is an error.
Please specify that using ocamlfind
with sublib
is an error.
@@ -120,8 +150,6 @@ val foreign: | |||
{ul | |||
{- If [packages] is set, then the given OPAM packages are |
Drup
Nov 21, 2016
Member
"given packages", not only OPAM packages anymore.
"given packages", not only OPAM packages anymore.
no_opam: bool; | ||
no_depext: bool; | ||
no_opam_version: bool | ||
result: 'a |
Drup
Nov 21, 2016
Member
Are we removing this record ? Keeping it make adding some argument back convenient, but ...
Are we removing this record ? Keeping it make adding some argument back convenient, but ...
let name = match name with None -> t.name | Some x -> x in | ||
Fmt.pf ppf "opam-version: \"1.2\"@." ; | ||
Fmt.pf ppf "name: \"%s\"@." name ; | ||
Fmt.pf ppf "depends: [ @[<2>%a@]@ ]@." |
Drup
Nov 21, 2016
Member
Maybe use a vertical box here ?
Maybe use a vertical box here ?
| None -> String.Map.add n p m | ||
| Some p' -> match Package.merge p.opam p p' with | ||
| Some p -> String.Map.add n p m | ||
| None -> invalid_arg "bad constraints") |
Drup
Nov 21, 2016
Member
We should provide a better error message (and in particular, which opam package triggers the conflict).
We should provide a better error message (and in particular, which opam package triggers the conflict).
let package_names t = | ||
List.map fst | ||
(List.filter (fun (_, p) -> p.build = false) | ||
(String.Map.bindings t.packages)) |
Drup
Nov 21, 2016
Member
I feel like you should move that stuff to the Package
module, and keep only Info.package
.
I feel like you should move that stuff to the Package
module, and keep only Info.package
.
hannesm
Nov 21, 2016
Author
Member
no. The Info record keeps track of a compilation unit, which contain a map of packages. The package module does only care about a single package.
no. The Info record keeps track of a compilation unit, which contain a map of packages. The package module does only care about a single package.
Drup
Nov 21, 2016
•
Member
Meh, Package
is the module that deals with packages. You want something from package list
to the list of ocamlfind libraries (resp. opam packages), I feel like it would belong there.
Meh, Package
is the module that deals with packages. You want something from package list
to the list of ocamlfind libraries (resp. opam packages), I feel like it would belong there.
@@ -113,7 +114,7 @@ let pp_dump_info module_name fmt i = | |||
"%s.{@ name = %S;@ \ | |||
@[<v 2>packages = %a@]@ ;@ @[<v 2>libraries = %a@]@ }" | |||
module_name (Info.name i) | |||
pp_packages (Info.packages i) | |||
pp_packages (Info.package_names i) |
Drup
Nov 21, 2016
Member
pp_dump_info
is used to expose the content of Info
to the underlying unikernel, in order to do things like an unikernel that lists the packages and the version it uses. It dumps an ml files with placeholder like %{functoria:version}%
and then call opam config subst
to substitute them.
That probably won't really work well anymore, so we need to move opam config subst
to the "make depend" target.
Since you have a bit more information now, we could enrich the datastructure in functoria-runtime with packages and dump that.
pp_dump_info
is used to expose the content of Info
to the underlying unikernel, in order to do things like an unikernel that lists the packages and the version it uses. It dumps an ml files with placeholder like %{functoria:version}%
and then call opam config subst
to substitute them.
That probably won't really work well anymore, so we need to move opam config subst
to the "make depend" target.
Since you have a bit more information now, we could enrich the datastructure in functoria-runtime with packages and dump that.
- contains opam name, ocamlfind names, version constraints, flag whether build-only dependency - users provide lists of packages - is combined into a single map (including merging of version numbers if possible) Also provide, based on this, to print an opam file (well, the good parts - name and dependencies)
- get rid of type 'a result - add vertical box in depends output - move logic of libraries and package_names to Package module - improve error messages
this is now pretty-printing a bit prettier (comment on the pr with magic open boxes etc. if you'd like to improve):
thing left is the info stuff drup explained above... this will need more thinking and integration into the build phase (but i guess it is ok to have it partially broken for some time)... |
I'm pretty happy with the last batch of changes. We just need to fix |
superseeded by #84 |
I played around a bit... so instead of having
~packages:string list ~libraries:string list
, why not have aPackage.t
type and use that (package : ?ocamlfind:[ `Prefix of string list | `Full of string list ] -> ?min:string -> ?max:string -> string -> t
)turns out, it is possible... but there are layering violations in mirage (expecting that during configure phase packages are already installed). the goal here is to just generate an
opam
file frommirage configure
, and let someone else install dependencies before invokingmake
see mirage/mirage#691
feedback welcome @samoht @Drup @yomimono @avsm