Make collect_related_packages() faster (by splitting inspect_package())