ocaml-opam / opam-depext

Attempt to automate the installation of system packages required by OPAM packages
Other
33 stars 28 forks source link

Inconsistent results when a package is installed (opam depext --list) vs explicit package check (opam depext --list foo) #64

Closed hcarty closed 4 years ago

hcarty commented 7 years ago

I get different, non-overlapping results when using depext to check currently installed packages (including some package X) and checking package X directly. I've seen this error so far with internal packages which seem to be pulling in phantom dependencies (ex. a dependency on openssl when none of the transient dependencies require openssl).

Do you have any suggestions for debugging this kind of issue?

AltGr commented 7 years ago

The issue probably lies in extracting the dependencies for foo. When checking the installed packages, nothing special needs to be done, but when checking specific packages, you want to get the depexts of their dependencies too.

These dependencies, however, are not strictly defined: there may be several options (depends: ["bar" | "baz"]). opam-depext uses the following opam call:

opam list --safe --recursive --external=TAGS --required-by=PACKAGES

You can remove the --external to get the list of packages opam got the depexts from. To be comprehensive, --recursive --required-by is used, which covers all possible cases, i.e. more than necessary in your case. We could replace that by --resolve, which only returns one possible solution, but then you get no warranties anymore that the following opam install call will work, if it makes a different choice.

The only way to solve this mismatch would be, I guess, tighter integration of depext into opam.

hcarty commented 7 years ago

Thank you for the explanation! Unfortunately I still get a strange mismatch with that command. I have a hopefully-someday-releasable wrapper around cohttp's client interface internally called ezrest. Its dependencies as reported by opam show are:

depends: cohttp & fmt & lwt & oasis >= 0.4 & ocamlfind & ocamlbuild & rresult

If I run the command you gave on just those dependencies there is no ssl dependency inferred:

$ opam list --safe --recursive --external=linux,ubuntu --required-by=cohttp,fmt,lwt,oasis,ocamlfind,ocamlbuild,rresult
# Known external dependencies for base.v0.9.3, base-bytes.base, base-num.base, base-unix.base, base64.2.2.0, camlp4.4.04+1, channel.1.1.1, cmdliner.1.0.0, cohttp.0.22.0, conduit.0.15.4, conf-m4.1, conf-ncurses.1, conf-pkg-config.1.0, conf-which.1, configurator.v0.9.1, cppo.1.5.0, cstruct.3.0.2, cstruct-lwt.3.0.2, duration.0.1.0, fd-send-recv.1.0.4, fieldslib.v0.9.0, fileutils.0.5.2, fmt.0.8.3, io-page.2.0.0, io-page-unix.2.0.0, ipaddr.2.8.0, jbuilder.1.0+beta10, logs.0.6.2, lwt.3.0.0, magic-mime.1.1.0, mirage-block.1.1.0, mirage-block-lwt.1.1.0, mirage-channel.3.1.0, mirage-channel-lwt.3.1.0, mirage-clock.1.3.0, mirage-clock-lwt.1.3.0, mirage-clock-unix.1.3.0, mirage-console.2.3.4, mirage-console-lwt.2.3.4, mirage-console-unix.2.3.4, mirage-device.1.1.0, mirage-flow.1.3.0, mirage-flow-lwt.1.4.0, mirage-fs.1.1.0, mirage-fs-lwt.1.1.0, mirage-kv.1.1.0, mirage-kv-lwt.1.1.0, mirage-net.1.1.0, mirage-net-lwt.1.1.0, mirage-net-unix.2.4.1, mirage-profile.0.8.0, mirage-protocols.1.2.0, mirage-protocols-lwt.1.2.0, mirage-random.1.1.0, mirage-stack.1.1.0, mirage-stack-lwt.1.1.0, mirage-time.1.1.0, mirage-time-lwt.1.1.0, mirage-types.3.0.0, mirage-types-lwt.3.0.0, mirage-unix.3.0.3, num.0, oasis.0.4.10, ocaml-compiler-libs.v0.9.0, ocaml-migrate-parsetree.1.0.1, ocamlbuild.0.11.0, ocamlfind.1.7.3, ocamlify.0.0.1, ocamlmod.0.0.8, ocplib-endian.1.0, octavius.1.1.0, optcomp.1.6, ospec.0.3.2, ounit.2.0.0, ppx_ast.v0.9.1, ppx_base.v0.9.0, ppx_compare.v0.9.0, ppx_core.v0.9.0, ppx_cstruct.3.0.2, ppx_deriving.4.1, ppx_driver.v0.9.1, ppx_enumerate.v0.9.0, ppx_fields_conv.v0.9.0, ppx_hash.v0.9.0, ppx_js_style.v0.9.0, ppx_metaquot.v0.9.0, ppx_optcomp.v0.9.0, ppx_sexp_conv.v0.9.0, ppx_tools.5.0, ppx_tools_versioned.5.0.1, ppx_traverse_builtins.v0.9.0, ppx_type_conv.v0.9.0, randomconv.0.1.0, re.1.7.1, result.1.2, rresult.0.5.0, sexplib.v0.9.1, shared-memory-ring.2.0.1, stdio.v0.9.0, stringext.1.4.3, tcpip.3.1.4, topkg.0.9.0, tuntap.1.5.0, type_conv.113.00.02, uchar.0.0.1, uint.1.2.0 and uri.1.9.4 on linux,ubuntu
debianutils
m4
ncurses-dev
pkg-config

but if I do the same for the ezrest package directly a dependency on ssl is inferred, pulling in a depext on libssl-dev in this case:

$ opam list --safe --recursive --external=linux,ubuntu --required-by=ezrest
# Known external dependencies for base.v0.9.3, base-bytes.base, base-num.base, base-unix.base, base64.2.2.0, camlp4.4.04+1, channel.1.1.1, cmdliner.1.0.0, cohttp.0.22.0, conduit.0.15.4, conf-m4.1, conf-ncurses.1, conf-openssl.1, conf-pkg-config.1.0, conf-which.1, configurator.v0.9.1, cppo.1.5.0, cstruct.3.0.2, cstruct-lwt.3.0.2, duration.0.1.0, ezrest.0.1.1, fd-send-recv.1.0.4, fieldslib.v0.9.0, fileutils.0.5.2, fmt.0.8.3, io-page.2.0.0, io-page-unix.2.0.0, ipaddr.2.8.0, jbuilder.1.0+beta10, logs.0.6.2, lwt.3.0.0, magic-mime.1.1.0, mirage-block.1.1.0, mirage-block-lwt.1.1.0, mirage-channel.3.1.0, mirage-channel-lwt.3.1.0, mirage-clock.1.3.0, mirage-clock-lwt.1.3.0, mirage-clock-unix.1.3.0, mirage-console.2.3.4, mirage-console-lwt.2.3.4, mirage-console-unix.2.3.4, mirage-device.1.1.0, mirage-flow.1.3.0, mirage-flow-lwt.1.4.0, mirage-fs.1.1.0, mirage-fs-lwt.1.1.0, mirage-kv.1.1.0, mirage-kv-lwt.1.1.0, mirage-net.1.1.0, mirage-net-lwt.1.1.0, mirage-net-unix.2.4.1, mirage-profile.0.8.0, mirage-protocols.1.2.0, mirage-protocols-lwt.1.2.0, mirage-random.1.1.0, mirage-stack.1.1.0, mirage-stack-lwt.1.1.0, mirage-time.1.1.0, mirage-time-lwt.1.1.0, mirage-types.3.0.0, mirage-types-lwt.3.0.0, mirage-unix.3.0.3, num.0, oasis.0.4.10, ocaml-compiler-libs.v0.9.0, ocaml-data-notation.0.0.11, ocaml-migrate-parsetree.1.0.1, ocamlbuild.0.11.0, ocamlfind.1.7.3, ocamlify.0.0.1, ocamlmod.0.0.8, ocplib-endian.1.0, octavius.1.1.0, optcomp.1.6, ospec.0.3.2, ounit.2.0.0, ppx_ast.v0.9.1, ppx_base.v0.9.0, ppx_compare.v0.9.0, ppx_core.v0.9.0, ppx_cstruct.3.0.2, ppx_deriving.4.1, ppx_driver.v0.9.1, ppx_enumerate.v0.9.0, ppx_fields_conv.v0.9.0, ppx_hash.v0.9.0, ppx_js_style.v0.9.0, ppx_metaquot.v0.9.0, ppx_optcomp.v0.9.0, ppx_sexp_conv.v0.9.0, ppx_tools.5.0, ppx_tools_versioned.5.0.1, ppx_traverse_builtins.v0.9.0, ppx_type_conv.v0.9.0, randomconv.0.1.0, re.1.7.1, result.1.2, rresult.0.5.0, sexplib.v0.9.1, shared-memory-ring.2.0.1, ssl.0.5.3, stdio.v0.9.0, stringext.1.4.3, tcpip.3.1.4, topkg.0.9.0, tuntap.1.5.0, type_conv.113.00.02, uchar.0.0.1, uint.1.2.0 and uri.1.9.4 on linux,ubuntu
debianutils
libssl-dev
m4
ncurses-dev
pkg-config

Do you know why this discrepancy would/could occur?

rjbou commented 4 years ago

External dependencies handling is integrated in opam (since 2.1.0-alpha). If this is still an issue, please open one in opam bugtracker. Thanks!