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

OCaml-CI should search for opam file names in pin-depends or vendored git submodules #826

Open
MisterDA opened this issue Jun 16, 2023 · 0 comments · May be fixed by #831
Open

OCaml-CI should search for opam file names in pin-depends or vendored git submodules #826

MisterDA opened this issue Jun 16, 2023 · 0 comments · May be fixed by #831
Labels
context/good first issue Good for newcomers type/enhancement New feature or request

Comments

@MisterDA
Copy link
Contributor

For a package foo, Dune expects or creates a foo.opam file containing the opam package description. ocaml-ci looks for these files, and will also look for opam/foo.opam.

let read_opam_file ~job ~repo ~hash pkg =
let opam_filename = OpamPackage.name_to_string pkg ^ ".opam" in
Cmd.git_show ~job ~repo hash opam_filename >>= function
| Ok contents -> Lwt_result.return contents
| Error (`Msg msg) -> (
Cmd.git_show ~job ~repo hash ("opam/" ^ opam_filename) >>= function
| Ok contents -> Lwt_result.return contents
| Error _ ->
Lwt.return
@@ Fmt.error_msg "Can't find %s (or opam/%s): %s" opam_filename
opam_filename msg)

ocaml-ci/lib/pin_depends.ml

Lines 140 to 144 in e12b7dc

let read_opam_file ~tarball ~prefix pkg =
let opam_filename = prefix ^ "/" ^ OpamPackage.name_to_string pkg ^ ".opam" in
let opam_filename' =
prefix ^ "/opam/" ^ OpamPackage.name_to_string pkg ^ ".opam"
in

Historically, or for projects not using the Dune build system (brr, topkg, Oasis, Makefiles…), the opam file is simply named opam.
Although ocaml-ci won't work on these projects (as it calls Dune directly and not opam), it should work with these projects being pinned using opam, or vendored: the pin-depends or vendored might carry patches or features necessary for the root project.

This shouldn't be super hard and could also be a nice little case for refactoring a piece of code. I suggest making sure that ocaml-ci stops looking for opam files as soon as the first conforming file is found.

@MisterDA MisterDA added type/enhancement New feature or request context/good first issue Good for newcomers labels Jun 16, 2023
@MisterDA MisterDA linked a pull request Jun 21, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
context/good first issue Good for newcomers type/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant