lpw25/opam-units — pull request #3 by dsheets (2014-09-03 13:13:40+00:00)
Title: Use the "model" of findlib to discover linkable compilation units

Reads archives and "browse interfaces" fields in the findlib db to
figure out which cmi files belong to a library. It is more accurate than
the previous method of simply taking all cmi files in a findlib
package's directory and assuming they are interfaces for that package
(this resulted in many duplicate units for basic distribution packages
like stdlib and bigarray, it also missed the num package entirely).

This patch fixes lpw25/opam-units#2 but introduces new, conservative
unit association issues. Most prominently, interfaces without
corresponding implementations (but with cmi files) don't show up in
archives and therefore don't get included. A possible fix for this is to
check a package directory for uniqueness and include all cmi files in
package directories that only belong to a single package.

Another issue with this patch is that META archive predicates that don't
include "byte" or "native" are skipped. This causes Pa_dyntype to be
skipped (only has "syntax" and other ones). Other issues include loose
cmi files without any implementations (netplex Netplex_admin), loose cmi
files with META omissions (netstring Netmappings_kr), and total ignorance of
packages with META files which lack archives or browse_interfaces
(ocamlnet rpc-generator).

There may be more issues but I have not found them in my limited testing.