I see that dpkg has a "Provides" field for packages.

Marqué :

I see that dpkg has a "Provides" field for packages.

$ apt-cache show vim-tiny | grep Provides Provides: editor $

How do I know which packages provide i.e. "editor"?

You can achieve the desired effect without aptitude (which appears to be discouraged these days) by using apt-cache showpkg, which includes a listing of Reverse Provides. Piping it through a small sed script will get rid of the other things:

apt-cache showpkg [HTML_REMOVED] | sed '/Reverse Provides/,$!d'

A slightly prettier (but longer to type) example (lists package names only, not versions, and sorts them alphabetically) can be achieved with awk:

apt-cache showpkg httpd | awk '/Pa/, /Reverse P/ {next} {print $1 | "sort"}'

...and this can be piped through uniq to remove duplicates (which may exist due to multiple versions of package being reverse-provides). Note that the use of uniq won't help with the first version, as uniq only removes duplicates if they're on adjacent lines and the sed version doesn't sort the output.

Finally, one can define a function for easier use, as follows:

provides () { apt-cache showpkg $1 | awk '/Pa/, /Reverse P/ {next} {print $1 | "sort"}' | uniq;}

Stick this in (for example) .bashrc, so that it'll load when the shell does, and it becomes possible to run provides [HTML_REMOVED] to get a package's reverse-provides.

Voir aussi