The dominator previously incorrectly reinstated source publications if
they were the latest one being considered for domination, even if that
was an inactive publication with only inactive Built-Using references.
If a source has Built-Using references to it but has already been
superseded by the dominator, then a subsequent run of the dominator will
still consider that source in case reinstatement is needed, and would
fail an assertion when trying to supersede a source that's already
superseded.
The simplest fix for this seems to be to have `planPackageDomination`
not add the publication to `supersede` or `delete` if it's already
inactive.
Keep source publications with Built-Using references from active binary
publications. This may extend to reinstating the source publication
(via a copy) if it had already been superseded or deleted.
It's possible for this to cause confusing effects if a manual deletion
races with a build that produces binaries with a Built-Using reference
to the deleted source. I've guarded against this as best I can, and
hope the remaining cases will be rare, but err on the side of honouring
the reference.
Guard removal of sources referenced by Built-Using
Prevent SourcePackagePublishingHistory.requestDeletion from deleting
source publications that have Built-Using references from active binary
publications in the same archive and suite.
This isn't necessarily complete: in particular, it can miss references
from other pockets, and in any case it might race with a build still in
progress. The intent of this is not to ensure integrity, but to avoid
some easily-detectable mistakes that could cause confusion.