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

failure with a pinned opam package #326

Closed
hannesm opened this issue Aug 8, 2022 · 9 comments · Fixed by #332
Closed

failure with a pinned opam package #326

hannesm opened this issue Aug 8, 2022 · 9 comments · Fixed by #332

Comments

@hannesm
Copy link
Contributor

hannesm commented Aug 8, 2022

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?

@Leonidas-from-XIV
Copy link
Member

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.

@Leonidas-from-XIV
Copy link
Member

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.

@hannesm
Copy link
Contributor Author

hannesm commented Aug 19, 2022

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.

@hannesm
Copy link
Contributor Author

hannesm commented Aug 29, 2022

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).

@Leonidas-from-XIV
Copy link
Member

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.

Leonidas-from-XIV added a commit to Leonidas-from-XIV/opam-monorepo that referenced this issue Aug 30, 2022
When using a pinned dependency the refs might not have a prefix (e.g.
`HEAD` is a plain ref) thus they wouldn't have been found when
attempting to resolve the refs.

Closes tarides#326
@Leonidas-from-XIV
Copy link
Member

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.

Leonidas-from-XIV added a commit to Leonidas-from-XIV/opam-monorepo that referenced this issue Nov 21, 2022
When using a pinned dependency the refs might not have a prefix (e.g.
`HEAD` is a plain ref) thus they wouldn't have been found when
attempting to resolve the refs.

Closes tarides#326
@hannesm
Copy link
Contributor Author

hannesm commented Dec 15, 2022

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.

@Leonidas-from-XIV
Copy link
Member

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

Leonidas-from-XIV added a commit to Leonidas-from-XIV/opam-repository that referenced this issue Dec 21, 2022
CHANGES:

### Changed

- Treat packages with no build commands as if they can be built with dune (tarides/opam-monorepo#355,
  @gridbugs)

### Fixed

- Fix resolving refs of locally pinned repositories (tarides/opam-monorepo#326, tarides/opam-monorepo#332, @hannesm,
  @Leonidas-from-XIV)
- Read the `compiler` flag from OPAM metadata thus classifying more packages
  correctly as base packages (tarides/opam-monorepo#328, @Leonidas-from-XIV)
- Fix bug where dev repo urls ending with a "/" would result in
  `opam monorepo pull` placing package source code directly inside the duniverse
  directory instead of in a subdirectory of the duniverse directory (tarides/opam-monorepo#359,
  @gridbugs)
@Leonidas-from-XIV
Copy link
Member

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

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

Successfully merging a pull request may close this issue.

2 participants