Skip to content

Commit

Permalink
opam: provide a dev-repo field to silence warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesm committed Oct 24, 2020
1 parent bb8a514 commit af9ead6
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions lib/mirage_configure.ml
Expand Up @@ -67,10 +67,16 @@ let find_git () =

let configure_opam ~name info =
let open Codegen in
let subdir, git_info =
let subdir, git_info, dev_repo =
match find_git () with
| Error _ -> None, None
| Ok (subdir, branch, git_url) -> subdir, Some (branch, git_url)
| Error _ -> None, None, "git+https://example.com/nonexistent"
| Ok (subdir, branch, git_url) ->
(* TODO is there a library for git urls anywhere? *)
let git_url = match Astring.String.cut ~sep:"github.com:" git_url with
| Some (_, post) -> "git+https://github.com/" ^ post
| _ -> git_url
in
subdir, Some (branch, git_url), git_url
in
let file = opam_path ~name in
with_output file (fun oc () ->
Expand All @@ -81,6 +87,7 @@ let configure_opam ~name info =
append fmt {|authors: "dummy"|};
append fmt {|homepage: "dummy"|};
append fmt {|bug-reports: "dummy"|};
append fmt "dev-repo: %S" dev_repo;
Format.fprintf fmt {|build: [ "sh" "-exc" "|};
(match subdir with
| None -> ()
Expand Down Expand Up @@ -108,12 +115,7 @@ let configure_opam ~name info =
(match git_info with
| None -> ()
| Some (branch, origin) ->
(* TODO is there a library for git urls anywhere? *)
let public = match Astring.String.cut ~sep:"github.com:" origin with
| Some (_, post) -> "git+https://github.com/" ^ post
| _ -> origin
in
append fmt {|url { src: "%s#%s" }|} public branch);
append fmt {|url { src: "%s#%s" }|} origin branch);
R.ok ())
"opam file"

Expand Down

0 comments on commit af9ead6

Please sign in to comment.