Conversation
- 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
switch to Logs and Bos (and Fpath) instead
app/functoria_app.ml
Outdated
| (fun () -> Engine.build i jobs) () | ||
| with | ||
| | Ok a -> a | ||
| | Error _ -> R.error_msg "failed to change directory for build" |
There was a problem hiding this comment.
Could you move the logic for directory changing in an auxiliary function ?
app/functoria_app.ml
Outdated
| Bos.OS.Dir.delete ~recurse:true (Fpath.v "_build") >>= fun () -> | ||
| Bos.OS.File.delete (Fpath.v "log") >>= fun () -> | ||
| Bos.OS.File.delete (Fpath.v "main.native.o") >>= fun () -> | ||
| Bos.OS.File.delete (Fpath.v "main.native")) () |
There was a problem hiding this comment.
Isn't main.native associated to mirage, more than functoria ? Nothing really specify what's the main target in functoria.
There was a problem hiding this comment.
was the same before
functoria/app/functoria_app.ml
Line 488 in d7a2015
since this PR is already pretty big, I'd leave the main.native question to a subsequent PR.
app/functoria_app.ml
Outdated
| in R.ok @@ with_fmt f | ||
| f Format.str_formatter ; | ||
| let data = Format.flush_str_formatter () in | ||
| Bos.OS.Cmd.run_in (Bos.Cmd.v dotcmd) (Bos.OS.Cmd.in_string data) |
There was a problem hiding this comment.
While you're at it (and you seem fluent in Bos), could you pipe that to a temp file and call dotcmd on the tempfile, instead ? See #81.
There was a problem hiding this comment.
you mean pp > tmp followed by dotcmd tmp?
lib/functoria.mli
Outdated
| method clean: Info.t -> (unit, Rresult.R.msg) Rresult.result | ||
| (** [clean info] is the code to clean-up what has been generated | ||
| by {!configure}. *) | ||
| by {!build}. *) |
There was a problem hiding this comment.
Not both ? How do we clean up things generated by configure then ?
lib/functoria_misc.ml
Outdated
| months.(time.Unix.tm_mon) (time.Unix.tm_year+1900) | ||
| time.Unix.tm_hour time.Unix.tm_min time.Unix.tm_sec in | ||
| Format.sprintf "Generated by %s (%s)." name date | ||
| Format.sprintf "Generated by functoria (%s)." date |
There was a problem hiding this comment.
I was asked specifically not to put functoria here. The actual application (aka mirage, or the unikernel) should put its name here. Not sure how @samoht 's position has evolved on the matter. :)
There was a problem hiding this comment.
I would still prefer to see mirage.VERSION here instead of functoria :-)
There was a problem hiding this comment.
I now use Sys.argv, this preserves the entire command line. Not sure how functoria would be able to access the mirage version string.
|
Not sure why you made a new PR instead on continuing on the old one. It would have been easier to review. Did you made sure that the log level option appears in the help ? It's not so clear to me by reading the code. Looks good otherwise. |
lib/functoria.mli
Outdated
| method build: Info.t -> (unit, Rresult.R.msg) Rresult.result | ||
| (** [build info] is the code to execute in order to build | ||
| the device. This might involve generating OCaml code, | ||
| running shell scripts, etc. *) |
There was a problem hiding this comment.
There is a clear overlap between the function of configure and build, according to the documentation. It should be much clearer what should go where and when things are executed.
|
@Drup: thanks for your review. you could read only the very last commit, which is the diff on top of the previous PR. it was not necessary here, but in the mirage repository a new PR made sense (since it partially reverts previous changes, such as the Makefile pkg-config thingies)
|
|
I really like the new generation of opam files, and the cleanup with Bos + Logs is very welcome. I also like the new |
|
@Drup I (hopefully) fixed all your comments :) (even the main.native) |
|
@samoht I don't understand your question. I do specifically (atm) not work on the ability to have various configurations (xen/unix/virtio) available at the same time. The workflow, as mentioned on mirageos-devel, will now be: The To smooth the transition, a Thus, for MirageOS unikernel developers: For CI systems, some instance can This change, in contrast to the earlier proposal, requires that the |
lib/functoria.mli
Outdated
| the device. This might involve generating OCaml code, | ||
| running shell scripts, etc. *) | ||
| the device. During the build phase, you can rely that all | ||
| {!packages} are available. This might involve generating |
There was a problem hiding this comment.
s/available/installed/
Maybe mention external tools explicitly ?
|
@hannesm What happens if I call |
Yes, that sounds like a good idea. |
|
@Drup the opam generated by mirage now emits a build rule. |
app/functoria_app.ml
Outdated
| let data = Format.flush_str_formatter () in | ||
| Bos.OS.File.tmp ~mode:0o644 "graph%s.dot" >>= fun tmp -> | ||
| Bos.OS.File.write tmp data >>= fun () -> | ||
| Bos.OS.Cmd.run Bos.Cmd.(v dotcmd % (Fpath.to_string tmp)) |
There was a problem hiding this comment.
This can be written OS.Cmd.run Cmd.(v dotcmd % p tmp)
|
(deleted, wrong PR and typo, sorry) |
|
@hannesm |
|
On 28/11/2016 16:07, Martin Lucina wrote:
@hannesm `mirage build ...` seems to accept all the configure-time options that `mirage configure ...` would for a unikernel (e.g. `--dhcp` ...) That doesn't seem right?
Interesting. the same is true for `mirage help clean`. not sure how to
avoid this, but #72 looks very related to this.
|
This is on top of #82, but also removes Cmd and Log, replacing it with Bos and Logs. ~~~For some unknown reason
mirage cleandoes not work as expected here. I might look into that later... otherwise, comments/feedback welcome (I'm sure I missed something)~~~It also re-introduces the
buildcommand (which calls out tobla#buildin the graph ('coz @samoht is always right ;) (reverts #76)Fixes #73 #74 #63 (removing Cmd) #54 (superseeds #82) #81
ready to go, commits can be squashed imho.