pkgutil: add multiple-target support in latest_version

This fixes #5606.
Merge pull request #5610 from terminalmage/issue5606

pkgutil: add multiple-target support in latest_version