[opam-devel] Finding dependencies of a specific OPAM package

Louis Gesbert louis.gesbert at ocamlpro.com
Tue Mar 24 10:05:38 GMT 2015


> - Anil Madhavapeddy, 23/03/2015 16:52 -
> Good point -- I'm looking for all the reverse dependency package cone of
> Cohttp that are installable for a particular version of Cohttp.  I will
> then install each of them separately, so there's no requirement for the
> results to all be coinstallable.

If you really just need this, you could:
- get the reverse dependency cone, as before
- try the coinstallation of cohttp and each member of this cone. If the solver returns no solution, just skip, otherwise check that all goes well:

    COHTTP=cohttp.0.15.2
    for p in $(opam list --rec --short --sort --depends-on $COHTTP); do
      if opam install --show $COHTTP $p; then opam install $COHTTP $p; fi
    done

Note that not specifying the version will just make OPAM choose the installed version, or failing that the highest available: it won't aggregate results for all versions. 

The `--short` format doesn't print any version numbers: if it's a shortcoming that should be fairly easy to improve; also, as Roberto said, any package that has a (possibly transitive) dependency to cohttp that may include that version will be included, even if it's not coinstallable.

To resolve in one step, I guess we could compute the set of packages coinstallable with this version of cohttp using Dose, and then take the intersection. (Or rather, the packages _not_ coinstallable and the difference ?)

> 
> The goal is to check that a new version of Cohttp doesn't break an existing
> package that worked with an earlier version, so that we can add an upper
> bound to the opam package before merging the new release (and of course to
> use this more generally with other packages too).
> 
> -anil
> 
> > On 23 Mar 2015, at 16:43, Roberto Di Cosmo <roberto at dicosmo.org> wrote:
> > 
> > Computing the reverse dependency cone of a package P is just a matter of
> > visiting the dependency graph, and you do not need any call to the solver
> > for this. 
> > 
> > But this reverse dependency cone may very well contain packages not coinstallable with P.
> > 
> > For example, if you have
> > 
> > package: a
> > depends: cohttp, b
> > 
> > package: cohttp
> > version: 1
> > conflicts: b
> > 
> > package: cohttp
> > version: 2
> > 
> > Then a is a reverse dependency for both versions of cohttp, even if it is
> > coinstallable only with version 2.
> > 
> > If you want all packages in the reverse dependency cone of cohttp _that are also
> > coinstallable with it_, then you need to actually call the solver on each of
> > them.
> > 
> > --
> > Roberto
> > 
> > On Mon, Mar 23, 2015 at 04:27:47PM +0000, Anil Madhavapeddy wrote:
> >> I'm trying to find all the reverse dependency of a particular version of Cohttp.  I can do:
> >> 
> >>    opam list --depends-on cohttp --rec
> >> 
> >> to get all of the dependencies for all versions.  Unfortunately trying:
> >> 
> >>    opam list --depends-on cohttp.0.15.2 --rec
> >> 
> >> gives the same results (including packages that depend on earlier versions of Cohttp and are specifically not installable with cohttp.0.15.2)
> >> 
> >> Any suggestions on how to resolve this?  I guess going through the list individually to check constraints is one way, but feely very clunky (and slow due to going through the solver so many times).
> >> 
> >> -anil
> >> _______________________________________________
> >> opam-devel mailing list
> >> opam-devel at lists.ocaml.org
> >> http://lists.ocaml.org/listinfo/opam-devel
> > 
> 
> _______________________________________________
> opam-devel mailing list
> opam-devel at lists.ocaml.org
> http://lists.ocaml.org/listinfo/opam-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.ocaml.org/pipermail/opam-devel/attachments/20150324/3ac39ffe/attachment.sig>


More information about the opam-devel mailing list