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.24k stars 357 forks source link

opam lock . creates lock files for opam files that aren't in the current directory #5425

Open kit-ty-kate opened 1 year ago

kit-ty-kate commented 1 year ago
FROM ocaml/opam:debian-11-ocaml-4.14@sha256:be39f69ee2a231426c13507846fa956c94266ab444dc87dd3c92dba69e923c99
RUN git clone https://github.com/ocurrent/opam-repo-ci/
WORKDIR opam-repo-ci
RUN git submodule update --init --recursive
RUN sudo ln -f /usr/bin/opam-dev /usr/bin/opam
RUN opam init --reinit
RUN git -C ~/opam-repository pull origin master && opam update
RUN opam pin add --recursive --no-action .
RUN opam install --deps .
RUN opam lock .

The last command will output:

[ERROR] Skipping opam-repo-ci-service.dev, dependencies are not satisfied in this switch, not installed packages are:
          - current_git
          - current_github
          - current_docker
          - current_web

Not all dependencies of opam-devel.2.2.0~alpha~dev are satisfied, not including these: conf-diffutils, conf-openssl
Generated lock files for:
  - opam-state.2.2.0~alpha~dev: /home/kit_ty_kate/work/opam-repo-ci/opam-state.opam.locked
  - opam-solver.2.2.0~alpha~dev: /home/kit_ty_kate/work/opam-repo-ci/opam-solver.opam.locked
  - opam-repository.2.2.0~alpha~dev: /home/kit_ty_kate/work/opam-repo-ci/opam-repository.opam.locked
  - opam-repo-ci-web.dev: /home/kit_ty_kate/work/opam-repo-ci/opam-repo-ci-web.opam.locked
  - opam-repo-ci-client.dev: /home/kit_ty_kate/work/opam-repo-ci/opam-repo-ci-client.opam.locked
  - opam-repo-ci-api.dev: /home/kit_ty_kate/work/opam-repo-ci/opam-repo-ci-api.opam.locked
  - opam-installer.2.2.0~alpha~dev: /home/kit_ty_kate/work/opam-repo-ci/opam-installer.opam.locked
  - opam-format.2.2.0~alpha~dev: /home/kit_ty_kate/work/opam-repo-ci/opam-format.opam.locked
  - opam-devel.2.2.0~alpha~dev: /home/kit_ty_kate/work/opam-repo-ci/opam-devel.opam.locked
  - opam-core.2.2.0~alpha~dev: /home/kit_ty_kate/work/opam-repo-ci/opam-core.opam.locked
  - opam-client.2.2.0~alpha~dev: /home/kit_ty_kate/work/opam-repo-ci/opam-client.opam.locked
  - opam-admin.dev: /home/kit_ty_kate/work/opam-repo-ci/opam-admin.opam.locked
  - opam.2.2.0~alpha~dev: /home/kit_ty_kate/work/opam-repo-ci/opam.opam.locked

All the opam-* from the opam subdirectory now have a lock file in the current directory except there is no corresponding opam file.

rjbou commented 1 year ago

It is the intended behaviour. Opam files of current directory can be found at

kit-ty-kate commented 1 year ago

It is the intended behaviour

I disagree. If your opam files are found in the opam directory then the generated lock files should also be generated there and not in the root directory.

rjbou commented 1 year ago

So the issue is not about opam lock input opam file location, but opam lock output file location. On opam lock output file, it is always on the current directory, where opam lock is called (see lock test). The behaviour can be changed, but it is the "normal" current behaviour of opam lock.

rjbou commented 1 year ago

From dev meeting: