lindig
August 10, 2023, 3:12pm
1
What is the proper way to pin the development repository of a package in an Opam file?
pin-depends: [ "fit" "git+https://github.com/lindig/fit.git" ]
error 3: File format error in 'pin-depends' at line 14, column 15: while expecting versioned package: OpamPackage.of_string
This receives an error but I struggle to see how I could provide a versioned package and it matches suggestions on the web. The Opam documentation is so abstract that I can’t figure it out. Also, does this still need a matching entry in the depends: [ ... "fit" {pinned}
…] field?
1 Like
I don’t have answers to the questions you raise. However I believe this pin-depends
here works.
So that would mean you need to define a version for fit
e.g. fit.~dev
. Possibly you may have to define a branch or commit after a #
on the git
repo.
The particular case I point to has no {pinned}
filter in depends:
(I think this is supposed to mean this dependency only exists whenever the package is pinned).
2 Likes
This should work:
pin-depends: [
["dream-html.dev" "git+https://github.com/yawaramin/dream-html"]
]
1 Like
lindig
August 11, 2023, 8:55am
4
Thanks for all replies. To summarize, I believe:
the package is listed in depends
the package is connected to a repo in pin-depends
depends: [
"dune" {>= "2.0"}
"dream" {>= "1.0.0~alpha5"}
"cmdliner" {>= "1.1.0"}
"fit"
]
pin-depends: ["fit.~dev" "git+https://github.com/lindig/fit.git#main"]
2 Likes
That looks right to me.
I would add that you need to make sure the pinned package is actually installed. An example from my local work on ocaml-h2.
$ opam install . --deps-only --yes --with-test
The following additional pinnings are required by h2-async.0.10.0:
- gluten-async.dev at git+https://github.com/tmcgilchrist/gluten#b611fca2e111fadc5ba989e172723ae91202d8fc
- gluten.dev at git+https://github.com/tmcgilchrist/gluten#b611fca2e111fadc5ba989e172723ae91202d8fc
Pin and install them? [Y/n] y
[gluten-async.dev] synchronised (no changes)
gluten-async is now pinned to git+https://github.com/tmcgilchrist/gluten#b611fca2e111fadc5ba989e172723ae91202d8fc (version dev)
[gluten.dev] synchronised (no changes)
gluten is now pinned to git+https://github.com/tmcgilchrist/gluten#b611fca2e111fadc5ba989e172723ae91202d8fc (version dev)
The following actions will be performed:
∗ install gluten-lwt 0.4.1
∗ install gluten-eio 0.4.1
∗ install gluten-mirage 0.4.1
∗ install gluten-lwt-unix 0.4.1
===== ∗ 4 =====
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><> 🐫
⬇ retrieved gluten-lwt.0.4.1 (cached)
⬇ retrieved gluten-mirage.0.4.1 (cached)
⬇ retrieved gluten-lwt-unix.0.4.1 (cached)
⬇ retrieved gluten-eio.0.4.1 (cached)
∗ installed gluten-eio.0.4.1
∗ installed gluten-lwt.0.4.1
∗ installed gluten-mirage.0.4.1
∗ installed gluten-lwt-unix.0.4.1
Done.
Querying the opam pin status shows that even though the pins exist they aren’t actually installed.
$ opam pin
gluten.dev (not in sync) git git+https://github.com/tmcgilchrist/gluten#b611fca2e111fadc5ba989e172723ae91202d8fc
(installed:0.4.1)
gluten-async.dev (not in sync) git git+https://github.com/tmcgilchrist/gluten#b611fca2e111fadc5ba989e172723ae91202d8fc
(installed:0.4.1)
A manual upgrade to the pinned dev
version is required:
$ opam upgrade gluten gluten-async
<><> Synchronising pinned packages ><><><><><><><><><><><><><><><><><><><><> 🐫
[gluten.dev] synchronised (no changes)
[gluten-async.dev] synchronised (no changes)
The following actions will be performed:
⊘ remove gluten-mirage 0.4.1 [uses gluten-lwt]
⊘ remove gluten-lwt-unix 0.4.1 [uses gluten-lwt]
⊘ remove gluten-eio 0.4.1 [conflicts with gluten]
⊘ remove gluten-lwt 0.4.1 [conflicts with gluten]
↗ upgrade gluten 0.4.1 to dev*
↗ upgrade gluten-async 0.4.1 to dev*
===== ↗ 2 ⊘ 4 =====
Do you want to continue? [Y/n] y
....
There’s possibly a more direct set of commands but this is what I’ve been using.