Make extra_packages state more efficient.