Revert "Deduplicate adapter-of-installed-packages code."

This reverts commit cb3aafcaa1aef1cd39c413974e2d154c1e2c06e1.