Factor out finding of scoped packages.