l.a.p.Publisher(object) : class documentation

Part of lp.archivepublisher.publishing View In Hierarchy

Publisher is the class used to provide the facility to publish files in the pool of a Distribution. The publisher objects will be instantiated by the archive build scripts and will be used throughout the processing of each DistroSeries and DistroArchSeries in question
Method __init__ Initialize a publisher.
Method setupArchiveDirs Undocumented
Method isDirty True if a publication has happened in this release and pocket.
Method markPocketDirty Mark a pocket dirty only if it's allowed.
Method isAllowed Whether or not the given suite should be considered.
Method subcomponents Undocumented
Method consider_series Undocumented
Method checkLegalPocket Check if the publication can happen in the archive.
Method getPendingSourcePublications Return the specific group of source records to be published.
Method publishSources Publish sources for a given distroseries and pocket.
Method findAndPublishSources Search for and publish all pending sources.
Method getPendingBinaryPublications Return the specific group of binary records to be published.
Method publishBinaries Publish binaries for a given distroarchseries and pocket.
Method findAndPublishBinaries Search for and publish all pending binaries.
Method A_publish First step in publishing: actual package publishing.
Method A2_markPocketsWithDeletionsDirty An intermediate step in publishing to detect deleted packages.
Method B_dominate Second step in publishing: domination.
Method C_doFTPArchive Does the ftp-archive step: generates Sources and Packages.
Method C_writeIndexes Write Index files (Packages & Sources) using LP information.
Method D_writeReleaseFiles Write out the Release files for the provided distribution.
Method createSeriesAliases Ensure that any series aliases exist.
Method checkDirtySuiteBeforePublishing Last check before publishing a dirty suite.
Method deleteArchive Delete the archive.
Method _allIndexFiles Return all index files on disk for a distroseries.
Method _latestNonEmptySeries Find the latest non-empty series in an archive.
Method _writeComponentIndexes Write Index files for single distroseries + pocket + component.
Method _getLabel Return the contents of the Release file Label field.
Method _getOrigin Return the contents of the Release file Origin field.
Method _updateByHash Update by-hash files for a suite.
Method _writeReleaseFile Write a Release file to the archive (as Release.new).
Method _syncTimestamps Make sure the timestamps on all files in a suite match.
Method _writeSuite Write out the Release files for the provided suite.
Method _writeSuiteArchOrSource Write out a Release file for an architecture or source.
Method _writeSuiteSource Write out a Release file for a suite's sources.
Method _writeSuiteArch Write out a Release file for an architecture in a suite.
Method _writeSuiteI18n Write out an Index file for translation files in a suite.
Method _readIndexFileHashes Read an index file and return its hashes.
def __init__(self, log, config, diskpool, archive, allowed_suites=None, library=None):
Initialize a publisher.

Publishers need the pool root dir and a DiskPool object.

Optionally we can pass a list of tuples, (distroseries.name, pocket), which will restrict the publisher actions, only suites listed in allowed_suites will be modified.

def setupArchiveDirs(self):
Undocumented
def isDirty(self, distroseries, pocket):
True if a publication has happened in this release and pocket.
def markPocketDirty(self, distroseries, pocket):
Mark a pocket dirty only if it's allowed.
def isAllowed(self, distroseries, pocket):
Whether or not the given suite should be considered.

Return True either if the self.allowed_suite is empty (was not specified in command line) or if the given suite is included in it.

Otherwise, return False.

@property
def subcomponents(self):
Undocumented
@property
def consider_series(self):
Undocumented
def checkLegalPocket(self, distroseries, pocket, is_careful):
Check if the publication can happen in the archive.
def getPendingSourcePublications(self, is_careful):
Return the specific group of source records to be published.
def publishSources(self, distroseries, pocket, spphs):
Publish sources for a given distroseries and pocket.
def findAndPublishSources(self, is_careful=False):
Search for and publish all pending sources.

Consider records returned by getPendingSourcePublications.

Parametersis_carefulIf True, republish all published records (system will DTRT checking the hash of all published files).
def getPendingBinaryPublications(self, is_careful):
Return the specific group of binary records to be published.
def publishBinaries(self, distroarchseries, pocket, bpphs):
Publish binaries for a given distroarchseries and pocket.
def findAndPublishBinaries(self, is_careful=False):
Search for and publish all pending binaries.

Consider records returned by getPendingBinaryPublications.

Parametersis_carefulIf True, republish all published records (system will DTRT checking the hash of all published files).
def A_publish(self, force_publishing):
First step in publishing: actual package publishing.

Publish each DistroSeries, which causes publishing records to be updated, and files to be placed on disk where necessary. If self.allowed_suites is set, restrict the publication procedure to them.

def A2_markPocketsWithDeletionsDirty(self):
An intermediate step in publishing to detect deleted packages.

Mark pockets containing deleted packages (status DELETED or OBSOLETE), scheduledeletiondate NULL and dateremoved NULL as dirty, to ensure that they are processed in death row.

def B_dominate(self, force_domination):
Second step in publishing: domination.
def C_doFTPArchive(self, is_careful):
Does the ftp-archive step: generates Sources and Packages.
def C_writeIndexes(self, is_careful):
Write Index files (Packages & Sources) using LP information.

Iterates over all distroseries and its pockets and components.

def D_writeReleaseFiles(self, is_careful):
Write out the Release files for the provided distribution.

If is_careful is specified, we include all pockets of all releases.

Otherwise we include only pockets flagged as true in dirty_pockets.

def _allIndexFiles(self, distroseries):
Return all index files on disk for a distroseries.

For each index file, this yields a tuple of (function to open file in uncompressed form, path to file).

def _latestNonEmptySeries(self):
Find the latest non-empty series in an archive.

Doing this properly (series with highest version and any active publications) is expensive. However, we just went to the effort of publishing everything; so a quick-and-dirty approach is to look through what we published on disk.

def createSeriesAliases(self):
Ensure that any series aliases exist.

The natural implementation would be to point the alias at self.distro.currentseries, but that works poorly for PPAs, where it's possible that no packages have been published for the current series. We also don't want to have to go through and republish all PPAs when we create a new series. Thus, we instead do the best we can by pointing the alias at the latest series with any publications in the archive, which is the best approximation to a development series for that PPA.

This does mean that the published alias might point to an older series, then you upload something to the alias and find that the alias has now moved to a newer series. What can I say? The requirements are not entirely coherent for PPAs given that packages are not automatically copied forward.

def _writeComponentIndexes(self, distroseries, pocket, component):
Write Index files for single distroseries + pocket + component.

Iterates over all supported architectures and 'sources', no support for installer-* yet. Write contents using LP info to an extra plain file (Packages.lp and Sources.lp .

def checkDirtySuiteBeforePublishing(self, distroseries, pocket):
Last check before publishing a dirty suite.

If the distroseries is stable and the archive doesn't allow updates in RELEASE pocket (primary archives) we certainly have a problem, better stop.

def _getLabel(self):
Return the contents of the Release file Label field.
Returnsa text that should be used as the value of the Release file 'Label' field.
def _getOrigin(self):
Return the contents of the Release file Origin field.

Primary, Partner and Copy archives use the distribution displayname. For PPAs we use a more specific value that follows get_ppa_reference.

Returnsa text that should be used as the value of the Release file 'Origin' field.
def _updateByHash(self, suite, release_file_name, extra_files):
Update by-hash files for a suite.

This takes Release file data which references a set of on-disk files, injects any newly-modified files from that set into the librarian and the ArchiveFile table, and updates the on-disk by-hash directories to be in sync with ArchiveFile. Any on-disk by-hash entries that ceased to be current sufficiently long ago are removed.

def _writeReleaseFile(self, suite, release_data):
Write a Release file to the archive (as Release.new).
ParameterssuiteThe name of the suite whose Release file is to be written.
release_dataA debian.deb822.Release object to write to the filesystem.
def _syncTimestamps(self, suite, all_files):
Make sure the timestamps on all files in a suite match.
def _writeSuite(self, distroseries, pocket):
Write out the Release files for the provided suite.
def _writeSuiteArchOrSource(self, distroseries, pocket, component, file_stub, arch_name, arch_path, all_series_files):
Write out a Release file for an architecture or source.
def _writeSuiteSource(self, distroseries, pocket, component, all_series_files):
Write out a Release file for a suite's sources.
def _writeSuiteArch(self, distroseries, pocket, component, arch_name, all_series_files):
Write out a Release file for an architecture in a suite.
def _writeSuiteI18n(self, distroseries, pocket, component, all_series_files):
Write out an Index file for translation files in a suite.
def _readIndexFileHashes(self, suite, file_name, subpath=None, real_file_name=None):
Read an index file and return its hashes.
ParameterssuiteSuite name.
file_nameFilename relative to the parent container directory.
subpathOptional subpath within the suite root. Generated indexes will not include this path. If omitted, filenames are assumed to be relative to the suite root.
real_file_nameThe actual filename to open when reading data (file_name will still be the name used in the returned dictionary). If this is passed, then the returned hash component dictionaries will include it in additional "real_name" items.
ReturnsA dictionary mapping hash field names to dictionaries of their components as defined by debian.deb822.Release (e.g. {"md5sum": {"md5sum": ..., "size": ..., "name": ...}}), or None if the file could not be found.
def deleteArchive(self):
Delete the archive.

Physically remove the entire archive from disk and set the archive's status to DELETED.

Any errors encountered while removing the archive from disk will be caught and an OOPS report generated.

API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.