Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

WIP check upstream #26

Open
wants to merge 1 commit into
base: 2.0
Choose a base branch
from
Open

WIP check upstream #26

wants to merge 1 commit into from

Conversation

rjbou
Copy link
Contributor

@rjbou rjbou commented Feb 19, 2019

Add check upstream: downloading archive & check hashes

@rjbou
Copy link
Contributor Author

rjbou commented Feb 20, 2019

related to ocaml/opam/issues/3504

@@ -692,18 +692,17 @@ module PrChecks = struct

let max_items_in_post = 50

let opam_files =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filter_opam_files ?

Lwt.return (nv, result)
) (opam_files files)
in
let ok =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, ça ne serait pas plus léger de faire un seul fold avec un quadruplet comme accumulateur ?

match upstream with
| Some url ->
let open OpamProcess.Job.Op in
OpamProcess.Job.run @@
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a little afraid of seeing OpamProcess.Job.run used repeatedly here, for a few reasons:

  • opam "jobs" are explicitely designed to handle parallelism at their own level, using e.g. OpamParallel.map
  • we use syscalls and signals for handling sub-processes, I would certainly double-check that those don't cause bad interaction with lwt
  • using this, the lwt scheduler will be blocked for the whole duration of the download, while it should be kept awake for listening to incoming requests (if just to ACK and queue them)

Note however that nested calls to OpamProcess.Job.run are supported (the outer scheduler is just freezed until the inner call terminates) ; using Lwt_preemptive (which should indeed be called Lwt_preemptable) might be enough to avoid the last issue, but requires careful use.

| _ -> None) upstream_check
in
let title, status =
if err <> [] || fatal <> []then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not display both upstream and lint warnings if we have both ? I would skip the elses here.

in
let warn = Printf.sprintf "No checksum defined for %s" (str_pkg warn) in
let err =
OpamStd.Format.itemize ~bullet:" * "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure this formatting will work, itemize is suposed to start at the beginning of a line.
Maybe just add a header? (e.g. "Errors:\n" ^ OpamStd.Format.itemize ...)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants