Fix pkg.installed regression (yumpkg5)

This fixes a regression caused by the "pre-flight" checks recently added
to the pkg.installed state. The check_db function was not properly
handling 32-bit packages on a 64-bit OS.

In the process of investigating this regression, I also discovered a bug
in which pkg.latest_version was not identifying 32-bit versions of
packages, effectively rendering it impossible to install these packages
using pkg.latest states.

This commit fixes both bugs. Resolves #7813.