Skip to content
New issue

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

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

Already on GitHub? # to your account

opam lock ignores pin-depends #5187

Open
kit-ty-kate opened this issue Jul 20, 2022 · 4 comments
Open

opam lock ignores pin-depends #5187

kit-ty-kate opened this issue Jul 20, 2022 · 4 comments

Comments

@kit-ty-kate
Copy link
Member

Let have two projects proj1 and proj2 in /tmp:

$ mkdir /tmp/proj1 /tmp/proj2

In /tmp/proj2/proj2.opam:

opam-version: "2.0"
depends: [
  "conf-aclocal"
]

In /tmp/proj1/proj1.opam:

opam-version: "2.0"
depends: [
  "conf-aclocal"
  "proj2"
]
pin-depends: [
  "proj2.dev" "file:///tmp/proj2"
]

Now let’s install proj1:

$ cd /tmp/proj1
$ opam switch create .

Now let’s create a lock file for proj1:

$ opam lock proj1

This will generate the following proj1.opam.locked:

opam-version: "2.0"
name: "proj1"
version: "dev"
depends: [
  "conf-aclocal" {= "2"}
  "conf-autoconf" {= "0.1"}
  "conf-automake" {= "1"}
  "conf-which" {= "1"}
  "proj2" {= "dev"}
]
url {
  src: "file:///private/tmp/proj1"
}

Here we can see that the pin-depends section is completely missing, thus the following will fail with:

$ opam switch remove .
$ opam switch create . --locked
[ERROR] Could not determine which packages to install for this switch:
  * Missing dependency:
    - proj2
    unknown package
@kit-ty-kate
Copy link
Member Author

(note that it works perfectly fine if i add pin-depends: ["proj2.dev" "file:///tmp/proj2"] by hand to the lock file)

@rjbou
Copy link
Collaborator

rjbou commented Jul 20, 2022

Lock file does not keep local pinned dependencies (cf. #4897), it should work with external one.

@kit-ty-kate
Copy link
Member Author

Local pins and pin-depends are different things imo, the second becomes the former but apart from that they’re quite different.

To me pin-depends should be part of the lock file if they are in the original opam file, but it makes sense to not include locally pinned packages by default.

@rjbou
Copy link
Collaborator

rjbou commented Jul 20, 2022

For opam lock, there is no difference between local pin or pin-depends. It looks for installed dependencies, if it is pinned, adds it in the lock file (only if not local).

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants