l.a.c.CustomUpload : class documentation

Part of lp.archivepublisher.customupload View In Hierarchy

Known subclasses: lp.archivepublisher.ddtp_tarball.DdtpTarballUpload, lp.archivepublisher.debian_installer.DebianInstallerUpload, lp.archivepublisher.dist_upgrader.DistUpgraderUpload, lp.archivepublisher.meta_data.MetaDataUpload, lp.archivepublisher.rosetta_translations.RosettaTranslationsUpload, lp.archivepublisher.signing.SigningUpload, lp.archivepublisher.static_translations.StaticTranslationsUpload

Base class for custom upload handlers
Class Method publish See ICustomUploadHandler.
Method __init__ Undocumented
Method process Process the upload and install it into the archive.
Static Method parsePath Parse tarfile_path, returning its useful components.
Method setComponents Set instance variables based on decomposing the filename.
Method setTargetDirectory Set self.targetdir based on parameters.
Class Method getSeriesKey Get a unique key for instances of this custom upload type.
Method checkForConflicts Check for conflicts with existing publications in the archive.
Method verifyBeforeExtracting Verify the tarball before extracting it.
Method extract Extract the custom upload to a temporary directory.
Method shouldInstall Returns True if the given filename should be installed.
Method ensurePath Ensure the parent directory exists.
Method shouldSign Returns True if the given filename should be signed.
Method sign Sign a file.
Method installFiles Install the files from the custom upload to the archive.
Method fixCurrentSymlink Update the 'current' symlink and prune old entries.
Method cleanup Clean up the temporary directory
Method _buildInstallPaths Build and return paths used to install files.
@classmethod
def publish(cls, packageupload, libraryfilealias, logger=None):
See ICustomUploadHandler.
def __init__(self, logger=None):
Undocumented
def process(self, archive, tarfile_path, suite):
Process the upload and install it into the archive.
@staticmethod
def parsePath(tarfile_path):
Parse tarfile_path, returning its useful components.
RaisesValueErrorIf tarfile_path is incorrectly formed.
def setComponents(tarfile_path):
Set instance variables based on decomposing the filename.
def setTargetDirectory(self, archive, tarfile_path, suite):
Set self.targetdir based on parameters.

This should also set self.version and self.arch (if applicable) as a side-effect.

@classmethod
def getSeriesKey(cls, tarfile_path):
Get a unique key for instances of this custom upload type.

The key should differ for any uploads that may be published simultaneously, but should be identical for (e.g.) different versions of the same type of upload on the same architecture in the same series. Returns None on failure to parse tarfile_path.

def checkForConflicts(self):
Check for conflicts with existing publications in the archive.
def verifyBeforeExtracting(self, tar):
Verify the tarball before extracting it.

Extracting tarballs from untrusted sources is extremely dangerous as it's trivial to overwrite any part of the filesystem that the user running this process has access to.

Here, we make sure that the file will extract to somewhere under the tmp dir, that the file is a directory, regular file or a symlink only, and that symlinks only resolve to stuff under the tmp dir.

def extract(self):
Extract the custom upload to a temporary directory.
def shouldInstall(self, filename):
Returns True if the given filename should be installed.
def _buildInstallPaths(self, basename, dirname):
Build and return paths used to install files.

Return a triple containing: (sourcepath, basepath, destpath)
Where:
 * sourcepath is the absolute path to the extracted location.
 * basepath is the relative path inside the target location.
 * destpath is the absolute path to the target location.
def ensurePath(self, path):
Ensure the parent directory exists.
def shouldSign(self, filename):
Returns True if the given filename should be signed.
def sign(self, archive, suite, filename):
Sign a file.

For now, we always write a detached signature to the input file name plus ".gpg".

def installFiles(self, archive, suite):
Install the files from the custom upload to the archive.
def fixCurrentSymlink(self):
Update the 'current' symlink and prune old entries.

The 'current' symbolic link will point to the latest version present in 'targetdir' and only the latest 3 valid entries will be kept.

Entries named as invalid versions, for instance 'alpha-X', will be ignored and left alone. That's because they were probably copied manually into this location, they should remain in place.

See DebVersion for more information about version validation.

def cleanup(self):
Clean up the temporary directory
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.