l.a.d.Dominator : class documentation

Part of lp.archivepublisher.domination View In Hierarchy

Manage the process of marking packages as superseded.

Packages are marked as superseded when they become obsolete.

Method __init__ Initialize the dominator.
Method dominatePackage Dominate publications for a single package.
Method findBinariesForDomination Find binary publications that need dominating.
Method dominateBinaries Perform domination on binary package publications.
Method findSourcesForDomination Find binary publications that need dominating.
Method dominateSources Perform domination on source package publications.
Method findPublishedSourcePackageNames Find currently published source packages.
Method findPublishedSPPHs Find currently published source publications for given package.
Method dominateSourceVersions Dominate source publications based on a set of "live" versions.
Method judge Judge superseded sources and binaries.
Method judgeAndDominate Perform the domination and superseding calculations
Method _sortPackages Partition publications by package name, and sort them.
Method _setScheduledDeletionDate Set the scheduleddeletiondate on a publishing record.
Method _judgeSuperseded Determine whether the superseded packages supplied should
Method _composeActiveSourcePubsCondition Compose ORM condition for restricting relevant source pubs.
def __init__(self, logger, archive):
Initialize the dominator.

This process should be run after the publisher has published new stuff into the distribution but before the publisher creates the file lists for apt-ftparchive.

def dominatePackage(self, sorted_pubs, live_versions, generalization, immutable_check=True):
Dominate publications for a single package.

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.

Parameterssorted_pubsA 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_versionsIterable 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.
generalizationA GeneralizedPublication helper representing the kind of publications these are: source or binary.
def _sortPackages(self, publications, generalization):
Partition publications by package name, and sort them.

The publications are sorted from most current to least current, as required by dominatePackage etc.

ParameterspublicationsAn iterable of SourcePackagePublishingHistory or of BinaryPackagePublishingHistory.
generalizationA GeneralizedPublication helper representing the kind of publications these are: source or binary.
ReturnsA 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.

def dominateBinaries(self, distroseries, pocket):
Perform domination on binary package publications.

Dominates binaries, restricted to distroseries, pocket, and self.archive.

def _composeActiveSourcePubsCondition(self, distroseries, pocket):
Compose ORM condition for restricting relevant source pubs.
def findSourcesForDomination(self, distroseries, pocket):
Find binary publications that need dominating.

This is only for traditional domination, where the latest published publication is always kept published. See find_live_source_versions for this logic.

To optimize for that logic, findSourcesForDomination will ignore publications that have no other publications competing for the same binary package. There'd be nothing to do for those cases.

def dominateSources(self, distroseries, pocket):
Perform domination on source package publications.

Dominates sources, restricted to distroseries, pocket, and self.archive.

def findPublishedSourcePackageNames(self, distroseries, pocket):
Find currently published source packages.

Returns an iterable of tuples: (name of source package, number of publications in Published state).

def findPublishedSPPHs(self, distroseries, pocket, package_name):
Find currently published source publications for given package.
def dominateSourceVersions(self, distroseries, pocket, package_name, live_versions, immutable_check=True):
Dominate source publications based on a set of "live" versions.

Active publications for the "live" versions will remain active. All other active publications for the same package (and the same archive, distroseries, and pocket) are marked superseded.

Unlike traditional domination, this allows multiple versions of a package to stay active in the same distroseries, archive, and pocket.

ParametersdistroseriesDistroSeries to dominate.
pocketPackagePublishingPocket to dominate.
package_nameSource package name, as text.
live_versionsIterable of all version strings that are to remain active.
def judge(self, distroseries, pocket):
Judge superseded sources and binaries.
def judgeAndDominate(self, distroseries, pocket):
Perform the domination and superseding calculations

It only works across the distroseries and pocket specified.

API Documentation for Launchpad, generated by pydoctor at 2018-08-14 00:00:04.