[opam-devel] Determining all required versions of all packages
Louis Gesbert
louis.gesbert at ocamlpro.com
Tue Nov 10 09:48:51 GMT 2015
Le mardi 10 novembre 2015, 09:12:08 David Allsopp a écrit :
> I'm starting to assemble high quality Windows amendments[1] for
> opam-repository in dra27/opam-repository/opam-windows. OPAM's age and the
> speed at which OCaml development moves means lots of packages have many
> versions (see, for example,
> https://github.com/dra27/opam-repository/commit/b7269d2ac853aeb45b1096ec0dba
> 7febbad149f2).
>
> Patching them all is tedious (and actually testing the installation of each
> version even more so!), especially as it's not that likely that too many
> people will ever bother installing older versions. Is there already a clever
> way where given a repository I can query all dependent packages of a
> specific version of each package. Most (probably all) packages depend just
> on ocamlfind, for example, not on ocamlfind 1.4.x?
It's not repository-specific, but
opam list --rec --depends-on <pkglist>
will give you the packages depending on the mentionned packages. Now it seems
that what you want to know is all packages that _would be made uninstallable_
if you were to remove this package. The closest we have to that is implemented
within the camelus bot, but submitting a PR with the given package removed is
likely not the UI you were hoping for :)
That part of the code is quite simple though [1], you build two package
universes using sets of opam files, call `OpamSolver.installable` on them, then
do some set operations. This completely ignores compiler/os constraints
though, so for something more thorough you may want to look into the more
complete Dose lib, like OWS does.
The script here [2] also tries to cover all installable packages in a minimum
of steps (greedily, minimum is not guaranteed at all). So another approach may
be to just run that and take the union of all solutions it returns.
Best,
Louis Gesbert - OCamlPro
[1]: https://github.com/AltGr/opam-bot/blob/aaa4ddefc83f9906480d24ae52d6da5c2a567ceb/opam_ci.ml#L320-L377
[2]: https://github.com/ocaml/opam/blob/master/admin-scripts/couverture.ml
More information about the opam-devel
mailing list