'In Opam how do I tell which package owns a given file?
In Opam how do I tell which package owns a given file under ${OPAMROOT}/system? If there is no direct mean to achieve this, is it possible to list files owned by a given package?
Solution 1:[1]
There is no such facility, as opam allows packages to install their files virtually everywhere. But in general structure is quite simple and most packages respect it:
- Each installed package has its own subfolder in
lib,etc,docandshare. - For each package
opamcreates an entryinstall/<package-name>.installthat may contain files that this package installed, if special facilities, provided by opam, were used in the installation process. - binaries are put into
binorsbinwithout further subdivision.
Solution 2:[2]
The following command lists all packages and the files included in them - one can dump the output to a file to search it.
opam list -s | xargs -t -n 1 opam show --list-files > files.txt
(tested with opam 2.1)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ivg |
| Solution 2 | glennsl |
