filter out conf-* packages and compiler packages

This commit is contained in:
zapashcanon 2021-09-07 15:53:38 +02:00
parent 66fdc5e5b1
commit aff6951841
Signed by: zapashcanon
GPG Key ID: 8981C3C62D1D28F1
2 changed files with 41 additions and 3 deletions

View File

@ -19,7 +19,7 @@ let verbose =
let info =
let doc = "Repository checker, outputs results to HTML format or raw." in
let man =
[ `S Manpage.s_bugs; `P "Email bug reports to <example@email.lol>." ]
[ `S Manpage.s_bugs; `P "Email bug reports to <contact@ocamlpro.com>." ]
in
Term.info "orel" ~version:"%%VERSION%%" ~doc ~exits:Term.default_exits ~man

View File

@ -50,6 +50,7 @@ let () =
in
let tbl = Hashtbl.create 256 in
let special_packages = [
"base-bigarray"
; "base-bytes"
@ -65,7 +66,44 @@ let () =
; "base-unsafe-string"
] in
List.iter (fun package -> Hashtbl.add tbl package ()) special_packages;
List.iter (fun package ->
Format.eprintf "ignored special package %s@." package;
Hashtbl.add tbl package ()
) special_packages;
let list_conf_packages =
Bos.Cmd.(
v "opam" % "list" % "--all" % "--no-switch" % "--repos" % instance
% "--normalise" % "--color" % "never" % "--short" % "--root" % opam_root % "--has-flag=conf")
in
let conf_packages =
match Bos.OS.Cmd.run_out list_conf_packages |> Bos.OS.Cmd.to_lines with
| Ok r -> r
| Error _ -> error "can't list conf packages"
in
List.iter (fun package ->
Format.eprintf "ignored conf package %s@." package;
Hashtbl.add tbl package ()
) conf_packages;
let list_compiler_packages =
Bos.Cmd.(
v "opam" % "list" % "--all" % "--no-switch" % "--repos" % instance
% "--normalise" % "--color" % "never" % "--short" % "--root" % opam_root % "--has-flag=compiler")
in
let compiler_packages =
match Bos.OS.Cmd.run_out list_compiler_packages |> Bos.OS.Cmd.to_lines with
| Ok r -> r
| Error _ -> error "can't list conf packages"
in
List.iter (fun package ->
Format.eprintf "ignored compiler package %s@." package;
Hashtbl.add tbl package ()
) compiler_packages;
let packages = List.filter (fun p -> not @@ Hashtbl.mem tbl p) packages in
@ -77,7 +115,7 @@ let () =
Format.eprintf "getting source for package %s... " package;
Format.pp_print_flush Format.err_formatter ();
match Bos.OS.Dir.must_exist download_dir with
| Ok _p -> Format.eprintf "done@."; Some download_dir_s
| Ok _p -> Format.eprintf "done (found in cache)@."; Some download_dir_s
| Error _e ->
match
Bos.OS.Cmd.run_status ~quiet:true