Deduplicate adapter-of-installed-packages code.