My own OCaml monorepo using monopam
0
fork

Configure Feed

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

warn on depexts only when doing source build and commit reporepo on bump

+77 -23
+21 -5
lib/cmd/repo.ml
··· 48 48 let v = String.sub s (i + 1) (String.length s - i - 1) in 49 49 (h, Some v) 50 50 51 + let auto_commit ~sys ~reporepo ~op = 52 + match 53 + Oi.Source.Reporepo.commit_dirty ~sys ~path:reporepo 54 + ~msg:(Fmt.str "oi repo %s" op) () 55 + with 56 + | [] -> () 57 + | files -> 58 + Fmt.pr " committed %d file(s) to reporepo HEAD@." (List.length files) 59 + 51 60 let parse_handle_version s = 52 61 match String.index_opt s '=' with 53 62 | None -> (s, None) ··· 493 502 unavailable@." 494 503 summary.total summary.kept summary.rewrote 495 504 (List.length summary.unavailable) 496 - end 505 + end; 506 + auto_commit ~sys ~reporepo ~op:(Fmt.str "add %s" handle) 497 507 in 498 508 let handle = 499 509 Arg.( ··· 621 631 (fun (pkg, reason) -> 622 632 Fmt.pr " %a %s: %s@." Oi.Style.warn_string "unavailable" pkg reason) 623 633 summary.unavailable 624 - end 634 + end; 635 + auto_commit ~sys ~reporepo ~op:(Fmt.str "bump %s" handle) 625 636 626 637 let cmd = 627 638 let run () reporepo reporepo_url handle_opt all url ref_ toolchain ··· 794 805 (fun t -> match parse_group t with [] -> None | g -> Some g) 795 806 pkgs 796 807 in 797 - match 808 + (match 798 809 Oi.Source.Reporepo.bump ~fs ~sys ~path:reporepo ~handle 799 810 ~root_packages:groups () 800 811 with ··· 805 816 (if List.length e.root_packages = 1 then "y" else "ies") 806 817 | `Unchanged e -> 807 818 Fmt.pr "No change: %s.%s already has that root-packages list.@." 808 - e.handle e.version 819 + e.handle e.version); 820 + auto_commit ~sys ~reporepo ~op:(Fmt.str "set-roots %s" handle) 809 821 in 810 822 let handle = 811 823 Arg.( ··· 875 887 Oi.Source.Reporepo.remove ~fs ~path:reporepo ~handle ?version (); 876 888 Fmt.pr "Removed %s%s from %s@." handle 877 889 (match version with None -> " (all versions)" | Some v -> "." ^ v) 878 - reporepo 890 + reporepo; 891 + auto_commit ~sys ~reporepo 892 + ~op: 893 + (Fmt.str "remove %s%s" handle 894 + (match version with None -> "" | Some v -> "." ^ v)) 879 895 in 880 896 let handle_spec = 881 897 Arg.(
+31 -13
lib/oi/pipeline.ml
··· 466 466 m "depext check: %d pkg(s) declare matching depexts, union = %d" 467 467 (List.length entries) 468 468 (OpamSysPkg.Set.cardinal all)); 469 - (* Defensive nudge for the case where source packages exist but 470 - declare no depexts active for this platform. Common on macOS 471 - when the package's opam file only declares Linux distros, or 472 - when the homebrew filter clause is missing. The build may 473 - still need system libraries (gmp, openssl, pkg-config, …); 474 - we emit a one-liner so the user isn't blindsided by a 475 - low-level [./configure] failure with no prior warning. *) 476 - if OpamSysPkg.Set.is_empty all && conf.os = "macos" then 477 - Say.warn 478 - "no system depexts matched for %d source package(s) on macOS. If \ 479 - the build fails with missing headers (gmp.h, openssl/ssl.h, …), \ 480 - install them with: brew install <pkg>" 481 - (List.length source_pkgs); 469 + (* Per-layer nudge for source packages that declare no active 470 + depexts on this platform. Compute the set of pkgs WITH active 471 + depexts and subtract from [source_pkgs] to find the silent 472 + ones. The build may still need system libraries (gmp, 473 + openssl, pkg-config, …) and we'd rather warn upfront than 474 + surface a [./configure] failure mid-build. *) 475 + let with_depexts = 476 + List.fold_left 477 + (fun acc e -> OpamPackage.Set.add e.Depexts.pkg acc) 478 + OpamPackage.Set.empty entries 479 + in 480 + let without_depexts = 481 + List.filter 482 + (fun p -> not (OpamPackage.Set.mem p with_depexts)) 483 + source_pkgs 484 + in 485 + (match without_depexts with 486 + | [] -> () 487 + | pkgs -> 488 + let names = 489 + pkgs 490 + |> List.map (fun p -> 491 + OpamPackage.Name.to_string (OpamPackage.name p)) 492 + |> List.sort_uniq String.compare 493 + |> String.concat ", " 494 + in 495 + Say.warn 496 + "no %s depexts declared for source build(s): %s. If the build \ 497 + fails with missing headers, install the relevant system \ 498 + packages." 499 + conf.os names); 482 500 if not (OpamSysPkg.Set.is_empty all) then ( 483 501 let st = Depexts.status all in 484 502 Log.info (fun m ->
+18 -5
lib/oi/source.ml
··· 243 243 (git_at_out ~sys ~path [ "rev-list"; "--count"; base ^ ".." ^ head ]) 244 244 with _ -> 0 245 245 246 - let push ?(on_step_start = fun _ _ -> ()) ~sys ~path () = 246 + let commit_dirty ~sys ~path ~msg () = 247 247 assert_clone path; 248 248 let porcelain = git_at_out ~sys ~path [ "status"; "--porcelain" ] in 249 249 let dirty_paths = ··· 252 252 if String.length line < 4 then None 253 253 else Some (String.sub line 3 (String.length line - 3))) 254 254 in 255 + if dirty_paths = [] then [] 256 + else begin 257 + git_at ~sys ~path [ "add"; "-A" ]; 258 + git_at_inherit ~sys ~path [ "commit"; "-m"; msg ]; 259 + dirty_paths 260 + end 261 + 262 + let push ?(on_step_start = fun _ _ -> ()) ~sys ~path () = 255 263 on_step_start 1 "commit local changes"; 256 264 let commit_step = 265 + let porcelain = git_at_out ~sys ~path [ "status"; "--porcelain" ] in 266 + let dirty_paths = 267 + porcelain |> String.split_on_char '\n' 268 + |> List.filter_map (fun line -> 269 + if String.length line < 4 then None 270 + else Some (String.sub line 3 (String.length line - 3))) 271 + in 257 272 if dirty_paths = [] then Step_commit { files = [] } 258 - else begin 259 - git_at ~sys ~path [ "add"; "-A" ]; 273 + else 260 274 let summary = 261 275 if List.length dirty_paths = 1 then List.hd dirty_paths 262 276 else Fmt.str "%d files" (List.length dirty_paths) ··· 269 283 summary 270 284 (String.concat "\n" (List.map (fun p -> " " ^ p) dirty_paths)) 271 285 in 272 - git_at_inherit ~sys ~path [ "commit"; "-m"; msg ]; 286 + let _ = commit_dirty ~sys ~path ~msg () in 273 287 Step_commit { files = dirty_paths } 274 - end 275 288 in 276 289 on_step_start 2 "pull --rebase from upstream"; 277 290 let head_before = git_at_out ~sys ~path [ "rev-parse"; "HEAD" ] in
+7
lib/oi/source.mli
··· 248 248 (** Stage and commit any uncommitted changes, [git pull --rebase] to bring in 249 249 upstream history, then [git push] if local is ahead. *) 250 250 251 + val commit_dirty : 252 + sys:D10.Sysops.t -> path:string -> msg:string -> unit -> string list 253 + (** Stage and commit any uncommitted changes in the reporepo at [path] with 254 + commit message [msg]. Returns the list of files that were committed (empty 255 + when the working tree is already clean, and no commit is created in that 256 + case). *) 257 + 251 258 val add : 252 259 fs:Eio.Fs.dir_ty Eio.Path.t -> 253 260 sys:D10.Sysops.t ->