_serialize_tasks: limit scope of dropped circular dependencies

Ensure that all members of a buildtime dependency cycle are merged
as a group, such that packages which depend on one or more members
of the group will only be merged *after* the entire group has been
merged.

This extends runtime cycle handling to also handle buildtime cycles
in cases where the buildtime dependencies happen to be satisfied by
installed packages. In situations when this is necessary, it is
desirable to rely on the old installed instances of these packages
as little as possible, since they might have been broken by the
upgrade of a package that is a member of the dependency cycle.
Upgrading members of the cycle as a group effectively minimizes
reliance on the old installed package instances, avoiding some cases
of bug 199856. For example, it should avoid bug 703676, where
libspectre reportedly failed to build against an old installed
instance of ghostscript-gpl.

Bug: https://bugs.gentoo.org/199856
Bug: https://bugs.gentoo.org/689644
Bug: https://bugs.gentoo.org/690436
Bug: https://bugs.gentoo.org/703676
Signed-off-by: Zac Medico <zmedico@gentoo.org>
2 files changed