Skip to content

Commit

Permalink
Do not print the full list of root packages
Browse files Browse the repository at this point in the history
This was causing a lot of noise on big monorepos such as Tezos for
instance.
The full selection information is still available when running
opam-monorepo in a more verbose mode.

Signed-off-by: Nathan Rebours <nathan.p.rebours@gmail.com>
  • Loading branch information
NathanReb committed Jun 4, 2021
1 parent 1f97bea commit f2666c7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

- Exclude packages depending on `jbuilder` from the lock step. Since dune 2.0, `jbuild` files are
not supported. A new `--allow-jbuilder` option have been added to enable the old behavior.
- Only print the full list of selected root packages once and only in verbose mode, simply printing
the number in the default logs. (#173, @NathanReb)

### Deprecated

Expand Down
14 changes: 9 additions & 5 deletions cli/lock.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@ open Import
open Types

let check_root_packages ~local_packages =
match local_packages with
| [] ->
let count = List.length local_packages in
match count with
| 0 ->
Rresult.R.error_msg
"Cannot find any packages to vendor.\n\
Either create some *.opam files in the local repository, or specify them manually via \
'opam monorepo lock <packages>'."
| local_packages ->
| _ ->
let pp_package_name fmt { Opam.name; _ } = Fmt.string fmt name in
Common.Logs.app (fun l ->
l "Using locally scanned package%a '%a' as the root%a." Pp.plural local_packages
l "Using %d locally scanned package%a as the root%a." count Pp.plural local_packages
Pp.plural local_packages);
Logs.info (fun l ->
l "Root package%a: %a." Pp.plural local_packages
Fmt.(list ~sep:(unit ",@ ") (styled `Yellow pp_package_name))
local_packages Pp.plural local_packages);
local_packages);
Ok ()

let opam_to_git_remote remote =
Expand Down
12 changes: 3 additions & 9 deletions lib/opam_solve.ml
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,11 @@ let calculate ~build_only ~allow_jbuilder ~local_opam_files ~local_packages ?oca
switch_state
>>= fun deps ->
Logs.app (fun l ->
l "%aFound %a opam dependencies for %a." Pp.Styled.header ()
l "%aFound %a opam dependencies for the root package%a." Pp.Styled.header ()
Fmt.(styled `Green int)
(List.length deps)
Fmt.(list ~sep:(unit " ") Pp.Styled.package)
local_packages);
(List.length deps) Pp.plural local_packages);
Logs.info (fun l ->
l "The dependencies for %a are: %a"
Fmt.(list ~sep:(unit ",@ ") Types.Opam.pp_package)
local_packages
Fmt.(list ~sep:(unit ",@ ") Opam.Pp.package)
deps);
l "The dependencies are: %a" Fmt.(list ~sep:(unit ",@ ") Opam.Pp.package) deps);
Logs.app (fun l ->
l "%aQuerying opam database for their metadata and Dune compatibility." Pp.Styled.header ());
Ok (List.map ~f:(get_opam_info ~switch_state) deps)

0 comments on commit f2666c7

Please sign in to comment.