Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kit-ty-kate opened this issue Jan 24, 2023 · 4 comments

Comments

@kit-ty-kate
Copy link
Member

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
Copy link
Collaborator

rjbou commented Mar 9, 2023

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

  • ./opam
  • ./pkg.opam
  • ./opam/opam
  • ./opam/pkg.opam
    As you submodule is a directory named opam, for opam it's opam-repo-ci opam files that are in that directory.

@kit-ty-kate
Copy link
Member Author

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
Copy link
Collaborator

rjbou commented Mar 10, 2023

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
Copy link
Collaborator

rjbou commented Mar 14, 2023

From dev meeting:

  • change default location to generate lock file near opam file
  • add --lock-file-location flag to choose location
  • use that flag to guarantee that old behaviour with older cli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants