ocaml / opam

opam is a source-based package manager. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.
https://opam.ocaml.org
Other
1.21k stars 348 forks source link

`opam admin filter` excludes some conditional dependencies #6023

Open samwgoldman opened 2 weeks ago

samwgoldman commented 2 weeks ago

My company has a sandboxed build environment, so we use opam admin filter to create a "mini repository" that we can then use to install packages without connecting to the network. Recently, this started causing issues, and I think it's caused by the changes in 0b240d2960133fd3d8aa8f008d7aa79534caa3b9.

Namely, the mini repository excludes necessary packages: host-system-other and host-arch-arm64. This causes builds to fail later when dependencies can't be satisfied because those packages are missing.

Steps to reproduce:

  1. Clone opam-repository
  2. Run opam admin filter --resolve 'ocaml-variants.5.2.0+options'
  3. Observe which packages are included

Expected result: The filtered repo should include all packages for any host kind, including all host systems and architectures.

Actual result: The filtered repo includes only host-system-mingw and host-arch-x86_64 (and related packages).

What I see when I try:

opam-repository$ opam admin filter --resolve 'ocaml-variants.5.2.0+options'
The following 13 packages will be kept in the repository (31500 packages will be REMOVED):
base-bigarray.base base-domains.base base-nnp.base base-threads.base base-unix.base conf-mingw-w64-gcc-x86_64.1 host-arch-x86_64.1 host-system-mingw.1 ocaml.5.2.0 ocaml-config.3 ocaml-env-mingw64.1 ocaml-variants.5.2.0+options system-mingw.1

I was able to work around by forcing certain packages to be included the filter, using --or --resolve host-system-other --resolve host-arch-arm64 --resolve host-arch-x86_64.

CatherineGasnier commented 2 weeks ago

@samwgoldman I also managed to make it keep the right packages by passing --environment=arch=x86_64,os=linux