Whitelist packages with names matching those specified before generating rules

Addresses #2690 but doesn't do any performance optimizations yet which we
could do now