Reset opam-repository before opam init --reinit
Move the opam-repository fetch/reset step ahead of opam init --reinit
in the build spec. With opam >= 2.4, the format-upgrade init populates a
marshalled repo cache against whichever opam-repository commit happens
to be checked out at that moment, and a subsequent opam update does not
invalidate it. With the previous ordering, when the bundled
~/opam-repository in the base image lagged behind the solver-selected
commit, the build container silently kept opam unaware of any package
introduced in the intervening commits, producing errors like:
[ERROR] Package base has no version v0.16.5.
Reordering so the reset happens first lets opam init build its cache
against the target SHA from the start. The trailing opam update -u
becomes a no-op in the common case but is kept for upgrade safety.
Reproduced and verified on ppc64le with opam 2.2/2.3/2.4/2.5: 2.2 and
2.3 worked with either ordering; 2.4 and 2.5 only work with this one.
36c1e7
-
Jan 01 00:00 +00:00