More fixes to the package removal

The selection of packages to remove is tricky, as explained in [the wiki](https://trac.lal.in2p3.fr/Quattor/wiki/Development/YumAndSPMA#Splittinguptransactions).

We need to ensure that we don't remove packages that are depended upon by any new stuff.  Otherwise we'll get conflicts that require manual intervention.  These commits handle all the cases I've came into.

The `repoquery` invocations are potentially slow.  I'll do some optimisations in a separate pull request.