ocaml / opam

opam is a source-based package manager. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.
https://opam.ocaml.org
Other
1.24k stars 354 forks source link

Pin on local repo with toplevel opam file fails #742

Closed dbuenzli closed 11 years ago

dbuenzli commented 11 years ago

It seems the feature that makes pinned repo read a toplevel opam file (2641bf825908) doesn't work.

Short version:

> opam pin uutf ~/uutf
/Users/dbuenzli/uutf/opam is an invalid OPAM filename
'opam pin uutf /Users/dbuenzli/uutf' failed.

Long version:

> opam pin --debug uutf ~/uutf
00:00.000  073635  73635                      locking /Users/dbuenzli/.opam/lock
00:00.001  073635  FILENAME                   cleandir /Users/dbuenzli/.opam/log
00:00.001  073635  SYSTEM                     rmdir /Users/dbuenzli/.opam/log
00:00.006  073635  SYSTEM                     mkdir /Users/dbuenzli/.opam/log
00:00.006  073635  FILE(aliases)              read /Users/dbuenzli/.opam/aliases
00:00.006  073635  STATE                      LOAD-STATE(global-lock)
00:00.006  073635  FILE(config)               read /Users/dbuenzli/.opam/config
00:00.012  073635  FILE(aliases)              read /Users/dbuenzli/.opam/aliases
00:00.018  073635  FILE(repo-config)          read /Users/dbuenzli/.opam/repo/pkgopkg/config
00:00.018  073635  FILE(repo-config)          read /Users/dbuenzli/.opam/repo/default/config
00:00.018  073635  FILE(repo-config)          read /Users/dbuenzli/.opam/repo/erratique-u/config
00:00.019  073635  FILE(pinned)               read /Users/dbuenzli/.opam/4.00.1/pinned
00:00.019  073635  FILE(installed)            read /Users/dbuenzli/.opam/4.00.1/installed
00:00.019  073635  FILE(installed.roots)      read /Users/dbuenzli/.opam/4.00.1/installed.roots
00:00.019  073635  FILE(reinstall)            read /Users/dbuenzli/.opam/4.00.1/reinstall
00:00.022  073635  STATE                      ROOT      : /Users/dbuenzli/.opam
00:00.022  073635  STATE                      SWITCH    : 4.00.1
00:00.022  073635  STATE                      COMPILER  : 4.00.1
00:00.022  073635  STATE                      COMPILERS : { 3.11.2, 3.12.1, 3.12.1+natdynlink-osx, 4.00.0, 4.00.0+debug-runtime, 4.00.0+fp, 4.00.1, 4.00.1+BER, 4.00.1+alloc-profiling, 4.00.1+annot, 4.00.1+french, 4.00.1+mirage-unix, 4.00.1+mirage-xen, 4.00.1+open-types, 4.00.1+raspberrypi, 4.00.1+short-types, 4.01.0dev+extension-points, 4.01.0dev+fp, 4.01.0dev+trunk, 4.02.0dev+fp, 4.02.0dev+trunk }
00:00.022  073635  STATE                      REPOS     : { default, erratique-u, pkgopkg }
00:00.022  073635  STATE                      PACKAGES  : 1335 packages
00:00.022  073635  STATE                      INSTALLED : { base-bigarray.base, base-threads.base, base-unix.base, bench.1.3, camomile.0.8.3, cmdliner.0.9.2, ctypes.0.1, deriving-ocsigen.0.3c, fileutils.0.4.4, gg.unreleased, js_of_ocaml.1.3.2, lambda-term.1.5, lwt.2.4.3, oasis.0.3.0, ocaml-data-notation.0.0.10, ocamlfind.1.3.3, ocamlify.0.0.1, ocamlmod.0.0.4, ocp-build.1.99.6-beta, ocp-indent.1.3.2, ocp-index.0.3.0, ounit.1.1.2, pkgopkg.repo, react.0.9.4, type_conv.109.28.00, typerex.1.99.6-beta, utop.1.7, uuidm.0.9.5, vg.unreleased, vz.unreleased, webglue.unreleased, xmlm.1.1.1, zed.1.2 }
00:00.022  073635  STATE                      ROOTS     : { base-bigarray.base, base-threads.base, base-unix.base, bench.1.3, cmdliner.0.9.2, ctypes.0.1, js_of_ocaml.1.3.2, oasis.0.3.0, ocp-indent.1.3.2, ocp-index.0.3.0, pkgopkg.repo, utop.1.7, uuidm.0.9.5, vg.unreleased, vz.unreleased, webglue.unreleased, xmlm.1.1.1 }
00:00.022  073635  STATE                      REINSTALL : {}
00:00.022  073635  FILE(installed)            read /Users/dbuenzli/.opam/4.00.1/installed
00:00.022  073635  FILE(aliases)              read /Users/dbuenzli/.opam/aliases
00:00.022  073635  73635                      locking /Users/dbuenzli/.opam/4.00.1/lock
00:00.022  073635  COMMAND                    pin {package=uutf; path=/Users/dbuenzli/uutf; kind=local}
00:00.022  073635  STATE                      LOAD-STATE(pin)
00:00.022  073635  FILE(config)               read /Users/dbuenzli/.opam/config
00:00.026  073635  FILE(aliases)              read /Users/dbuenzli/.opam/aliases
00:00.032  073635  FILE(repo-config)          read /Users/dbuenzli/.opam/repo/pkgopkg/config
00:00.032  073635  FILE(repo-config)          read /Users/dbuenzli/.opam/repo/default/config
00:00.032  073635  FILE(repo-config)          read /Users/dbuenzli/.opam/repo/erratique-u/config
00:00.032  073635  FILE(pinned)               read /Users/dbuenzli/.opam/4.00.1/pinned
00:00.032  073635  FILE(installed)            read /Users/dbuenzli/.opam/4.00.1/installed
00:00.032  073635  FILE(installed.roots)      read /Users/dbuenzli/.opam/4.00.1/installed.roots
00:00.032  073635  FILE(reinstall)            read /Users/dbuenzli/.opam/4.00.1/reinstall
00:00.036  073635  STATE                      ROOT      : /Users/dbuenzli/.opam
00:00.036  073635  STATE                      SWITCH    : 4.00.1
00:00.036  073635  STATE                      COMPILER  : 4.00.1
00:00.036  073635  STATE                      COMPILERS : { 3.11.2, 3.12.1, 3.12.1+natdynlink-osx, 4.00.0, 4.00.0+debug-runtime, 4.00.0+fp, 4.00.1, 4.00.1+BER, 4.00.1+alloc-profiling, 4.00.1+annot, 4.00.1+french, 4.00.1+mirage-unix, 4.00.1+mirage-xen, 4.00.1+open-types, 4.00.1+raspberrypi, 4.00.1+short-types, 4.01.0dev+extension-points, 4.01.0dev+fp, 4.01.0dev+trunk, 4.02.0dev+fp, 4.02.0dev+trunk }
00:00.036  073635  STATE                      REPOS     : { default, erratique-u, pkgopkg }
00:00.036  073635  STATE                      PACKAGES  : 1335 packages
00:00.036  073635  STATE                      INSTALLED : { base-bigarray.base, base-threads.base, base-unix.base, bench.1.3, camomile.0.8.3, cmdliner.0.9.2, ctypes.0.1, deriving-ocsigen.0.3c, fileutils.0.4.4, gg.unreleased, js_of_ocaml.1.3.2, lambda-term.1.5, lwt.2.4.3, oasis.0.3.0, ocaml-data-notation.0.0.10, ocamlfind.1.3.3, ocamlify.0.0.1, ocamlmod.0.0.4, ocp-build.1.99.6-beta, ocp-indent.1.3.2, ocp-index.0.3.0, ounit.1.1.2, pkgopkg.repo, react.0.9.4, type_conv.109.28.00, typerex.1.99.6-beta, utop.1.7, uuidm.0.9.5, vg.unreleased, vz.unreleased, webglue.unreleased, xmlm.1.1.1, zed.1.2 }
00:00.036  073635  STATE                      ROOTS     : { base-bigarray.base, base-threads.base, base-unix.base, bench.1.3, cmdliner.0.9.2, ctypes.0.1, js_of_ocaml.1.3.2, oasis.0.3.0, ocp-indent.1.3.2, ocp-index.0.3.0, pkgopkg.repo, utop.1.7, uuidm.0.9.5, vg.unreleased, vz.unreleased, webglue.unreleased, xmlm.1.1.1 }
00:00.036  073635  STATE                      REINSTALL : {}
00:00.036  073635  FILE(pinned)               read /Users/dbuenzli/.opam/4.00.1/pinned
00:00.036  073635  COMMAND                    Adding /Users/dbuenzli/uutf(local) => uutf
00:00.036  073635  FILENAME                   rmdir /Users/dbuenzli/.opam/4.00.1/build/uutf.0.9.1
00:00.036  073635  FILENAME                   rmdir /Users/dbuenzli/.opam/4.00.1/packages.dev/uutf.0.9.1
00:00.036  073635  FILE(pinned)               write /Users/dbuenzli/.opam/4.00.1/pinned
00:00.037  073635  FILE(opam)                 read /Users/dbuenzli/uutf/opam
/Users/dbuenzli/uutf/opam is an invalid OPAM filename
00:00.037  073635  73635                      unlocking /Users/dbuenzli/.opam/4.00.1/lock
00:00.037  073635  SYSTEM                     rm /Users/dbuenzli/.opam/4.00.1/lock
00:00.037  073635  73635                      unlocking /Users/dbuenzli/.opam/lock
00:00.037  073635  SYSTEM                     rm /Users/dbuenzli/.opam/lock
'opam pin --debug uutf /Users/dbuenzli/uutf' failed.
dbuenzli commented 11 years ago

The same is true for pinning with a remote repo. However the error is different. Here it doesn't try to use the toplevel opam file from the git repo, it uses the (now outdated) regular one from ocamlpro's repo. The override doesn't work.

> opam pin uutf https://github.com/dbuenzli/uutf
> opam update
pkgopkg    Fetching http://erratique.ch/repos/pkgopkg.git
erratique-u Downloading http://erratique.ch/software/opam/unreleased/urls.txt
default    Downloading http://opam.ocamlpro.com/urls.txt
Updating ~/.opam/repo/index ...
Updating ~/.opam/compilers/ ...
Updating ~/.opam/packages/ ...
gg.unreleased Fetching https://github.com/dbuenzli/gg.git
pkgopkg.repo Fetching http://erratique.ch/repos/pkgopkg.git
vg.unreleased Fetching https://github.com/dbuenzli/vg.git
vz.unreleased Fetching https://github.com/dbuenzli/vz.git
webglue.unreleased Fetching https://github.com/dbuenzli/webglue
ctypes.pinned Fetching https://github.com/ocamllabs/ocaml-ctypes.git
Updating the cache of metadata (~/.opam/state.cache) ...
Everything is up-to-date.
> opam install uutf
The following actions will be performed:
 - install uutf.pinned
1 to install | 0 to reinstall | 0 to upgrade | 0 to downgrade | 0 to remove

  Installing uutf.pinned 
uutf.pinned Fetching https://github.com/dbuenzli/uutf
Copying /Users/dbuenzli/.opam/4.00.1/overlay/uutf.pinned/files/uutf.install to /Users/dbuenzli/.opam/4.00.1/build/uutf.pinned/
Building uutf.pinned:
  ocaml setup.ml -configure --prefix /Users/dbuenzli/.opam/4.00.1
  ocaml setup.ml -build
  ocaml setup.ml -install
The compilation of uutf.pinned failed.
Removing uutf.pinned.
  ocamlfind remove uutf

==== ERROR [while installing uutf.0.9.1] ====
# opam-version    1.1.0 (92d02d4eaa3deb09f04c5ce3325fa4ef945e2009)
# os              darwin
# command         ocaml setup.ml -configure --prefix /Users/dbuenzli/.opam/4.00.1
# path            /Users/dbuenzli/.opam/4.00.1/build/uutf.pinned
# compiler        4.00.1
# exit-code       2
# env-file        /Users/dbuenzli/.opam/4.00.1/build/uutf.pinned/uutf-81538-d2d111.env
# stdout-file     /Users/dbuenzli/.opam/4.00.1/build/uutf.pinned/uutf-81538-d2d111.out
# stderr-file     /Users/dbuenzli/.opam/4.00.1/build/uutf.pinned/uutf-81538-d2d111.err
### stderr ###
Cannot find file setup.ml.

'opam install uutf' failed.
samoht commented 11 years ago

I've tested your two examples and they seem to work fine on master.

dbuenzli commented 11 years ago

Excellent, I also just tested with a dummy repo, it seems to work. Thanks for the fix.