tarides / opam-monorepo

Assemble dune workspaces to build your project and its dependencies as a whole

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

failure with a pinned opam package

hannesm opened this issue · comments

I try to use opam monorepo 0.3.3 with the following pins:
gmp.6.2.1-2 (uninstalled) git git+file:///usr/home/hannes/devel/mirage/ocaml-gmp#HEAD

And receive a failure during opam monorepo lock:

gmake[2]: Leaving directory '/usr/home/hannes/devel/mirage/mirage-skeleton/applications/static_website_tls'
 ↳ generate lockfile for monorepo dependencies
==> Using 1 locally scanned package as the target.
==> Found 130 opam dependencies for the target package.
==> Querying opam database for their metadata and Dune compatibility.
==> Calculating exact pins for each of them.
opam-monorepo: [ERROR] No HEAD ref for file:///usr/home/hannes/devel/mirage/ocaml-gmp

It would be pretty nice to support pins to git repositories the same as opam does, or are there any blockers?

Hmm, that's strange. It should be able to find a HEAD ref, given that you specifically pinned it to HEAD, so at least that error message is pretty much incorrect.

Can you help me by passing ways to reproduce? I checked out mirage-skeleton and added ocaml-gmp from the Mirage org as a pin but I don't know how to get it to do the locking. When i make lock it fails with a lot of error messages.

so. in a clean opam switch

  1. git clone https://github.com/mirage/ocaml-gmp.git
  2. opam pin add -n gmp `pwd`/ocaml-gmp#HEAD (to pin gmp)
  3. opam instal mirage (should be 4.2+)
  4. git clone https://github.com/mirage/mirage-skeleton.git
  5. cd mirage-skeleton/applications/static_website_tls
  6. mirage configure -t hvt
  7. make depend (which calls opam monorepo lock)

If you run into issues ("it fails with a log of error messages"), please report the step and the failure you encounter.

Any chance you could post your "lot of error messages", or expose where you're stuck? I suspect opam-monorepo fails if you opam pin add <whatever-dep> `pwd`#HEAD -- which is my goto-solution for local pins that are git-controlled (opam takes the HEAD -- i.e. if I add commits, or switch branches, an opam reinstall will do the right thing).

Ah I guess my problem was that I tried running make lock in the toplevel:

/bin/sh: line 1: cd: tutorial/noop/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: tutorial/noop-functor/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: tutorial/hello/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: tutorial/hello-key/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: tutorial/lwt/echo_server/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: tutorial/lwt/heads1/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: tutorial/lwt/heads2/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: tutorial/lwt/timeout1/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: tutorial/lwt/timeout2/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: tutorial/lwt/echo_server/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: tutorial/app_info/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: device-usage/clock/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: device-usage/conduit_server/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: device-usage/console/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: device-usage/http-fetch/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: device-usage/kv_ro/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: device-usage/network/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: device-usage/ping6/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: device-usage/prng/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: applications/docteur/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: applications/dhcp/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: applications/git/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: applications/dns/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: applications/crypto/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: applications/static_website_tls/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
/bin/sh: line 1: cd: device-usage/block/mirage: No such file or directory
ls: cannot access '*.opam': No such file or directory
[opam-overlays] no changes from git+https://github.com/dune-universe/opam-overlays.git
[NOTE] Repository opam-overlays has been added to the selections of switch /home/me/mirage-skeleton only.
       Run `opam repository add opam-overlays --all-switches|--set-default' to use it in all existing switches, or in newly created switches, respectively.

[mirage-opam-overlays] no changes from git+https://github.com/dune-universe/mirage-opam-overlays.git
[NOTE] Repository mirage-opam-overlays has been added to the selections of switch /home/me/mirage-skeleton only.
       Run `opam repository add mirage-opam-overlays --all-switches|--set-default' to use it in all existing switches, or in newly created switches, respectively.

env OPAMVAR_monorepo="opam-monorepo" opam monorepo lock --recurse-opam  --build-only --ocaml-version 4.14.0 -l ./mirage.opam.locked
opam-monorepo: [ERROR] Cannot find any packages to vendor.
Either create some *.opam files in the local repository, or specify them manually via 'opam monorepo lock <packages>'.
make: *** [Makefile:67: lock] Error 1

I'll try your steps.

Created #332 to fix the problem. I am not entirely sure why the code is like that, but let's see what the code review will say.

Even with the latest release, 0.3.4, this issue persists. Are there any plans to fix and release this issue? It is pretty annoying.

@hannesm It's been fixed in #332 so the current main should work, I'll cut a release soon.

@hannesm I've created a 0.3.5 release which includes the fix: ocaml/opam-repository#22765