The latest publication for any version in live_versions stays
active. Any older publications (including older publications for
live versions with multiple publications) are marked as superseded by
the respective oldest live releases that are newer than the superseded
ones.

Any versions that are newer than anything in live_versions are
marked as deleted. This should not be possible in Soyuz-native
archives, but it can happen during archive imports when the
previous latest version of a package has disappeared from the Sources
list we import.

Parameters

sorted_pubs

A list of publications for the same package,
in the same archive, series, and pocket, all with status
PackagePublishingStatus.PUBLISHED. They must be sorted from
most current to least current, as would be the result of
generalization.sortPublications.

live_versions

Iterable of versions that are still considered
"live" for this package. For any of these, the latest publication
among publications will remain Published. Publications for
older releases, as well as older publications of live versions,
will be marked as Superseded. Publications of newer versions than
are listed in live_versions are marked as Deleted.

A dict mapping each package name to a sorted list of
publications from publications.

def
_setScheduledDeletionDate(self, pub_record):

Set the scheduleddeletiondate on a publishing record.

If the status is DELETED we set the date to UTC_NOW, otherwise
it gets the configured stay of execution period.

def
_judgeSuperseded(self, source_records, binary_records):

Determine whether the superseded packages supplied should
be moved to death row or not.

Currently this is done by assuming that any superseded binary
package should be removed. In the future this should attempt
to supersede binaries in build-sized chunks only, bug 55030.

Superseded source packages are considered removable when they
have no binaries in this distroseries which are published or
superseded

When a package is considered for death row it is given a
'scheduled deletion date' of now plus the defined 'stay of execution'
time provided in the configuration parameter.

def
findBinariesForDomination(self, distroarchseries, pocket):

Find binary publications that need dominating.

This is only for traditional domination, where the latest published
publication is always kept published. It will ignore publications
that have no other publications competing for the same binary package.