package handlers: add possibility for final teardown

Add a ph_fini callback to package handlers, so they can do teardown
operations, if needed, at the very end of the supermin run.

Currently all of the current package handlers do nothing.
rpm: use the rpm library instead of invoking rpm

Look for the rpm library, and use it to query for the information
needed, such as:
 - the list of installed packages
 - the list of requires for a specified package
 - the providers of a specified capability
 - the list of files of a package

Also, rework the dependency resolution, using a queue to iterate on the
packages not resolved yet (thus resolving each package just once), and
caching the provider of each capability.