Fix pkg.latest regression

This commit fixes a regression in which the pkg.latest state fails if
there is no new version of a package, even if the currently-installed
version matches the newest in the repositories.
Merge pull request #3387 from archtaku/pkg_latest

Fix pkg.latest regression