Monorepo management for opam overlays
0
fork

Configure Feed

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

monopam/lint: require (source ...) to match upstream when one is set

Forks (sources.toml entries with an upstream URL) had their
dune-project source check pass against either the fork URL or the
upstream URL. The fork is internal to the monorepo's collaboration
model; the canonical home is upstream, and that is the URL that
ends up in dev-repo: when the .opam ships to opam-repository.

Treat upstream as the single source of truth when set, and only
fall back to the default-origin URL for subtrees without an
upstream entry. Eight subtrees (ca-certs, ocaml-cbor, ocaml-cookie,
ocaml-json, ocaml-jwt, ocaml-tar, ocaml-toml, ocaml-yaml) get
flagged: they currently point at the fork rather than upstream.

+11 -12
+11 -12
lib/lint.ml
··· 455 455 | Some e -> Option.map normalise_url e.upstream 456 456 | None -> None 457 457 in 458 + (* When sources.toml declares an [upstream] for the subtree, the canonical 459 + home is upstream and dune-project's (source ...) must match it: the 460 + generated dev-repo: ends up published in opam-repository, where it 461 + points users (and tooling) at upstream rather than the in-monorepo 462 + fork. Otherwise the default-origin URL is the expected one. *) 463 + let expected = 464 + match upstream with Some _ -> upstream | None -> source 465 + in 458 466 match dune with 459 467 | No_dune_project -> None 460 468 | No_source -> 461 - (* Without a (source ...) stanza dune emits no dev-repo: in the 462 - generated .opam, which breaks downstream tooling that reads 463 - dev-repo to identify the subtree (e.g. root.opam dep filtering). *) 464 - Some { subtree; dune_project = None; sources_toml = source } 469 + Some { subtree; dune_project = None; sources_toml = expected } 465 470 | Has_source d -> 466 - let matches_source = 467 - match source with Some s -> s = d | None -> false 468 - in 469 - let matches_upstream = 470 - match upstream with Some u -> u = d | None -> false 471 - in 472 - if matches_source || matches_upstream then None 473 - else Some { subtree; dune_project = Some d; sources_toml = source }) 471 + if Option.equal String.equal expected (Some d) then None 472 + else Some { subtree; dune_project = Some d; sources_toml = expected }) 474 473 subdirs 475 474 476 475 let sort_source_issues (issues : source_issue list) =