Monorepo management for opam overlays
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

monopam: add split command for opam-repo sync

Exports opam files from monorepo packages to opam-repo overlay.
Scans mono/ for dune-project files with (generate_opam_files),
transforms them for opam-repo (adds dev-repo, url stanzas),
and commits the changes.

+40
+39
bin/cmd_split.ml
··· 1 + open Cmdliner 2 + 3 + let cmd = 4 + let doc = "Export opam files from monorepo to opam-repo" in 5 + let man = 6 + [ 7 + `S Manpage.s_description; 8 + `P 9 + "Generates opam-repo entries from dune-project files in the monorepo. \ 10 + This syncs the opam-repo overlay with the current monorepo state."; 11 + `S "WHAT IT DOES"; 12 + `I ("1.", "Scans mono/ for dune-project files with (generate_opam_files)"); 13 + `I 14 + ( "2.", 15 + "Transforms opam files for opam-repo (adds dev-repo, url stanzas)" ); 16 + `I ("3.", "Writes to opam-repo/packages/<name>/<name>.dev/opam"); 17 + `I ("4.", "Removes orphaned packages not in monorepo"); 18 + `I ("5.", "Stages and commits changes in opam-repo"); 19 + `S "EXAMPLE"; 20 + `Pre "monopam split # Sync all packages"; 21 + `Pre "monopam split aos # Sync only aos package"; 22 + `S Manpage.s_see_also; 23 + `P "$(b,monopam push)(1), $(b,monopam status)(1)"; 24 + ] 25 + in 26 + let info = Cmd.info "split" ~doc ~man in 27 + let run package () = 28 + Eio_main.run @@ fun env -> 29 + Common.with_config env @@ fun config -> 30 + let fs = Eio.Stdenv.fs env in 31 + match Monopam.sync_opam_files ~fs ~config ?package () with 32 + | Ok result -> 33 + Fmt.pr "%a@." Monopam.pp_opam_sync_result result; 34 + `Ok () 35 + | Error e -> 36 + Fmt.epr "Error: %a@." Monopam.pp_error_with_hint e; 37 + `Error (false, "split failed") 38 + in 39 + Cmd.v info Term.(ret (const run $ Common.package_arg $ Common.logging_term))
+1
bin/main.ml
··· 59 59 Cmd_diff.cmd; 60 60 Cmd_init.cmd; 61 61 Cmd_clean.cmd; 62 + Cmd_split.cmd; 62 63 Cmd_verse.cmd; 63 64 ] 64 65