Skip to content

opam lock does not include pin-depends for with-test dependencies #5428

@tsnobip

Description

@tsnobip

Here is a minimized version of my project's opam file:

opam-version: "2.0"
maintainer: "foo@bar.baz"
depends: [
  "bisect_ppx" {with-test}
  "dune" {>= "3.4"}
  "ocaml" {>= "5.0.0"}
  "ocaml-protoc-plugin"
]
synopsis: "repro for pinned test deps"
pin-depends: [
  [ "bisect_ppx.dev" "git+https://github.com/anmonteiro/bisect_ppx#cc442a08e3a2e0e18deb48f3a696076ac0986728" ]
  [ "ocaml-protoc-plugin.dev" "git+https://github.com/dialohq/ocaml-protoc-plugin#b814b305520563fff58388682cb360660cc29c47" ]
]

When I install the dependencies (opam install . --with-test) and execute opam lock ., here is my opam.locked file:

opam-version: "2.0"
maintainer: "foo@bar.baz"
depends: [
  "bisect_ppx" {= "dev" & with-test}
  "dune" {= "3.6.1"}
  "ocaml" {= "5.0.0"}
  "ocaml-protoc-plugin" {= "dev"}
]
synopsis: "repro for pinned test deps"
pin-depends: [
  [ "ocaml-protoc-plugin.dev" "git+https://github.com/dialohq/ocaml-protoc-plugin#b814b305520563fff58388682cb360660cc29c47" ]
]

As you can see, the pin-depends of the with-test dependency doesn't get added, which later creates issues when doing:

opam install . --locked --with-test

Tested with opam 2.1.4 and opam master.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions