Favor installed providing packages

Fixes #135.

If there are multiple providing packages, find the first one that's installed. If none are installed, arbitrarily use the first package.