Optimize the generation of the package group