Conversation
|
Is that the final final one? :) I'm not completely sure about having dune stanza in functoria devices, but maybe tying functoria with dune is the best way forward. It certainly seems like a working solution! For the rest, it looks good to me. |
|
Can you rebase your PR with |
|
Hello @Drup, yes indeed this PR specializes functoria for the mirage use-case by making it dune-specific. However I think that adding a new layer of abstraction (the build system) would make the changes a bit more complicated, but that's something we can still explore in the future. We could make functoria (and thus mirage) more build/package-system independent: we could imagine other "build backends" such as |
|
I'm not opposed to it, on the contrary. My very initial worry was in the context where there was no "dominant" tool, and the most used one wasn't terribly satisfactory. This is not really the case anymore. :) |
|
As far as I can see, the PR is good for me. The CI is correct and we tested it in few unikernels this branch (so, yes @Drup, this is the last one 😃). We should have a double-check for someone else (/cc @mirage/core). Then, we can really start the process release of MirageOS 4 🎉. |
|
If there are specific tasks or tests required to help with merging and releasing this, please let me know. I find myself with (1) a bit of extra time and (2) unikernels I'd like to build within a larger Dune project, and (2) doesn't work well with the current released tooling. |
lib/functoria/filegen.ml
Outdated
| | `Sexp -> Fmt.str ";; Generated by" | ||
| | `Opam | `Make -> "# Generated by" | ||
| | `OCaml -> "(* Generated by" | ||
| | `OpamLock -> "synopsis: \"duniverse generated" |
There was a problem hiding this comment.
why does headers and short_headers disagree on what to do for OpamLock?
There was a problem hiding this comment.
Also: OpamLock doesn't seem to be used elsewhere?
There was a problem hiding this comment.
headers is used when Mirage generates files.
short_headers is used to identify files generated by Mirage.
For the opam lockfile, only the identification function (short_headers) was used to remove the file in the clean step. Now that most mirage files (include the lockfile) are stored together inside the mirage/ folder, there's no need to identify OpamLock anymore so it can be removed
| ] | ||
|
|
||
|
|
||
| Query local opam |
There was a problem hiding this comment.
So by reading that example, I understood the local/global distinction wrongly. @TheLortex can you try to clarify this a bit?
What's the difference between the local/global/install/locked opam files? :-)
There was a problem hiding this comment.
There are three opam files in a mirage project:
<name>.opam: unikernel depencies that have to be locally fetched so that they exist in the dune workspace. Notably all runtime dependencies should be in that opam file, but it can also contain build tools as long as they build using dune.<name>.opam.locked: unikernel dependencies lockfile obtained usingopam-monorepo.<name>-install.opam: the rest of the build tools, the main example beingocaml-freestanding. They are installed in the switch using opam.
I agree that the names are a bit confusing but I don't know any other option. The rationale is that there are dependencies that need to be installed globally in your opam switch and that there are runtime dependencies that need to be locally fetched alongside the unikernel files as a monorepo in a dune workspace.
There was a problem hiding this comment.
New proposal:
- global becomes switch
- local becomes monorepo
Therefore the names are more in sync with the traditional ocaml concepts (opam switch and opam-monorepo)
What do you think ?
Currently, we have an unofficial explanation from @TheLortex about MirageOS 4 which is available here: https://next.mirage.io/wiki/mirage-4. It will be nice if you can reproduce the process locally and give to us some feedbacks 👍 - it will help us a lot to catch missing steps/states/etc. PS: note that the website is deployed with MirageOS 4 |
|
Some updates on the PR:
Mirage CI is still using 2.0 so I'll update that |
|
Can you rebase/cleanup against master? I think it's good to merge. I have extra changes to run e2e tests as cram tests, I can add those after the merge to avoid more conflicts. |
|
I'm rebasing/cleaning up this PR.
|
|
It's all green! @dinosaure or @TheLortex do you want to have a last review? |
|
I would like to double-check |
Yea it was done on purpose, as the various commits didn't compile separately and were intertwined :-) It's also fine to make other PRs to fix the remaining issues (if needed) |
|
I've juste updated mirage-dev's |
|
@TheLortex is the workflow to a PR documented somewhere? Do you think we should keep that workflow once 4.00 is released or it's just a temporary workflow? Maybe we want this to happen for every commit to |
I think we should delete the MirageOS 3.0 support then and keep only one pipeline about MirageOS 4. |
|
The pipeline is described here: https://github.com/ocurrent/mirage-ci |
|
So to be clear, the CI tests this PR along with mirage/mirage-dev#345 and mirage/mirage-skeleton#303 |
Runs a command with stdout and stdin redirected to it. Allows keeping interactive terminal capabilities.
|
I rebased the PR to include #1233, let's see |
|
No the CI stuff has been fixed, now it's all automatic :D |
|
(I think @hannesm fixed it recently?) And |
|
Let's try the |
So it seems fixed via my PR on |
|
@samoht you can merge when you want, the CI is green 🌲 |
|
Welcome to MirageOS 4.0 :p |
|
Woohoo! |
|
HELL YEAH |
This is hopefully the final attempt for the integration of
dunein Mirage. There are various documents scattered around this repository explaining the changes. For reference:You should be able to test this PR using the following documentation: https://next.mirage.io/wiki/mirage-4
It uses https://github.com/mirage/mirage-dev/tree/mirage-4 for packages that haven't been upstreamed yet.
Goal
The goal is to locally fetch unikernel dependencies and use
duneto build unikernels, taking advantage of thedune-workspace(https://dune.readthedocs.io/en/stable/dune-files.html#dune-workspace) file to define and customize mirage targets.Only build tools are to be installed in the opam switch, the unikernel runtime dependencies are locally fetched using the
opam-monorepotool: https://github.com/ocamllabs/opam-monorepo.opam-monorepolacks some features needed for mirage but they will be upstreamed and a release will be made before Mirage 4 comes out: in the meantime the required patches have been aggregated in my personal repository: https://github.com/TheLortex/duniverse/tree/mirage-4.PR changes
I've split the changes into small commits for increased readability, but the commits are not self-contained (i.e. build might fail between two commits).
Functoria: add Action.run_cmd_cli: When
config.exeorduneis run it's nice to keep the interactive terminal capabilities. So theAction.run_cmd_cliaction behaves similarly toAction.run_cmdbut without touchingstdinorstdout.Functoria: separate installation kind for packages: Build tools need to be installed in the switch (ocaml-freestanding, solo5, ..) and runtime libraries to be locally fetched (mirage-solo5, mirage-runtime, ...), so we separate the two kind of packages using a
Global | Localvariant. Two opam files are generated, one consumed byopamand the other consumed byopam-monorepo.Functoria CLI: add extra-repo option: Not all packages build with
dune. For the others, an overlay opam repository has to be used in order to make them compatible with mirage. The--extra-repooption takes care of adding a custom overlay repository when fetching the dependencies. By default it'shttps://github.com/mirage/opam-overlaysFunctoria: file generation only happen configure-time: At build time, a functoria device can use
dunerules to generate files.Functoria: move context cache in
<build_dir>/ <P.name> /context: Instead ofmirage.context: the goal is to reduce the amount of files generated in the unikernel folder. For that matter, most files will be generated in<build_dir>/mirageFunctoria: makefile -> use opam-monorepo to locally fetch deps: Update Makefile generation
Functoria: add Dune helper module to generate dune files / devices can have dune rules to generate files at build time / generate dune files, use dune to build unikernels: Generating dune files to build applications.
Functoria: update app_info device: adapt to previous changes
Mirage: adapt to functoria changes
Mirage: target interface changes: the interface changes a bit, now that targets have to issue dune rules and workspace configuration to build unikernels
Mirage: adapt targets to dune: target-specific rules to build unikernels using dune
Mirage: port devices to dune: devices such as
crunchnow issues dune rules instead of build-time actionsNow that the dune build layout is approved and tested, it believe it's important to have it merged so that people other than me can get used to it and be able to contribute directly. If you have any remarks on any part of the changes I'll glad to hear them and make appropriate updates.
For CI: mirage/mirage-dev#345 / mirage/mirage-skeleton#307