More robust way to prevent the generation of non required packages