pkgutil: add multiple-target support in latest_version

This fixes #5606.