Skip to content

Commit

Permalink
Only add root pin-depends in the .opam.locked file
Browse files Browse the repository at this point in the history
  • Loading branch information
samoht committed Oct 27, 2023
1 parent b2bac74 commit 023ae79
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
5 changes: 4 additions & 1 deletion cli/lock.ml
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,11 @@ let run (`Root root) (`Recurse_opam recurse) (`Build_only build_only)
Common.Logs.app (fun l -> l "Calculating exact pins for each of them.");
let* duniverse = compute_duniverse ~dependency_entries >>= resolve_ref in
let target_depexts = target_depexts opam_files target_packages in
let pin_depends =
match root_pin_depends opam_files with Ok r -> r | Error _ -> []
in
let lockfile =
D.Lockfile.create ~source_config ~root_packages:target_packages
D.Lockfile.create ~source_config ~root_packages:target_packages ~pin_depends
~dependency_entries ~root_depexts:target_depexts ~duniverse ()
in
let cli_args = raw_cli_args () in
Expand Down
11 changes: 2 additions & 9 deletions lib/lockfile.ml
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,6 @@ end
module Pin_depends = struct
type t = (OpamPackage.t * OpamUrl.t) list

let from_duniverse l =
let open Duniverse.Repo in
List.concat_map l ~f:(fun { provided_packages; url; _ } ->
let url = Url.to_opam_url url in
List.map provided_packages ~f:(fun p -> (p, url)))

let sort t =
List.sort ~cmp:(fun (pkg, _) (pkg', _) -> OpamPackage.compare pkg pkg') t
end
Expand Down Expand Up @@ -293,11 +287,10 @@ type t = {

let depexts t = t.depexts

let create ~source_config ~root_packages ~dependency_entries ~root_depexts
~duniverse () =
let create ~source_config ~root_packages ~pin_depends ~dependency_entries
~root_depexts ~duniverse () =
let version = Version.current in
let depends = Depends.from_dependency_entries dependency_entries in
let pin_depends = Pin_depends.from_duniverse duniverse in
let duniverse_dirs = Duniverse_dirs.from_duniverse duniverse in
let depexts = Depexts.all ~root_depexts ~dependency_entries in
{
Expand Down
1 change: 1 addition & 0 deletions lib/lockfile.mli
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ end
val create :
source_config:Source_opam_config.t ->
root_packages:OpamPackage.Name.Set.t ->
pin_depends:(OpamPackage.t * OpamUrl.t) list ->
dependency_entries:Opam.Dependency_entry.t list ->
root_depexts:(OpamSysPkg.Set.t * OpamTypes.filter) list list ->
duniverse:Duniverse.t ->
Expand Down
4 changes: 0 additions & 4 deletions test/bin/simple-lock.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ The lockfile should contain the base packages, dune and our 2 dependencies
"ocaml-config" {= "2"}
"ocaml-options-vanilla" {= "1"}
]
pin-depends: [
["b.1" "https://b.com/b.tbz"]
["c.1" "https://c.com/c.tbz"]
]
x-opam-monorepo-duniverse-dirs: [
[
"https://b.com/b.tbz"
Expand Down

0 comments on commit 023ae79

Please sign in to comment.