l.s.t.f.FakePackager : class documentation

Part of lp.soyuz.tests.fakepackager View In Hierarchy

Builds small and fully functional debian source packages

It uses a series of templates to build controllable sources to be used in Soyuz tests.

Method __init__ Create a 'sandbox' directory.
Method buildUpstream Build a fake source upstream version.
Method buildVersion Initialize a new version of extracted package.
Method buildSource Build a new version of the source package.
Method listAvailableUploads Return the path for all available changesfiles.
Method uploadSourceVersion Upload and publish a source package from the sandbox directory.
Method _createNewSandbox Create the 'sandbox' path as a temporary directory.
Method _importGPGKey Import the given secret GPG key to sign packages.
Method _appendContents Append a given content in the upstream 'contents' file.
Method _buildOrig Build a gzip tarball of the current 'upstream_directory'.
Method _createFile Create a file in the given path with the given content.
Method _populateChangelog Create an empty debian/changelog
Method _populateControl Create the debian/control using 'control_file_template'.
Method _populateCopyright Create a placeholder debian/copyright.
Method _populateRules Create the debian/rules using 'rules_file_template'.
Method _populateDebian Create and populate a minimal debian directory.
Method _prependChangelogEntry Prepend a changelog entry in the current upstream directory.
Method _runSubProcess Run the given script and collects STDOUT and STDERR.
Method _getChangefilePathForVersion Return the changesfile path for a given (version, type).
Method _doUpload Upload a given version.
def __init__(self, name, version, key_path=None):
Create a 'sandbox' directory.
def _createNewSandbox(self):
Create the 'sandbox' path as a temporary directory.

Also register an atexit handler to remove it on normal termination.

def _importGPGKey(self, key_path):
Import the given secret GPG key to sign packages.

Return the fingerprint of the imported key, prefixed with '0x'.

def _appendContents(self, content):
Append a given content in the upstream 'contents' file.

Use this method to add arbitrary content to this non-debian file.

def _buildOrig(self):
Build a gzip tarball of the current 'upstream_directory'.

The tarball will be named 'name_version.orig.tar.gz' and located at the sandbox root.

def _createFile(self, path, content=''):
Create a file in the given path with the given content.

A new line is appended at the end of the file.

def _populateChangelog(self):
Create an empty debian/changelog
def _populateControl(self, section=None, arch=None):
Create the debian/control using 'control_file_template'.
def _populateCopyright(self):
Create a placeholder debian/copyright.
def _populateRules(self):
Create the debian/rules using 'rules_file_template'.
def _populateDebian(self, section, arch):
Create and populate a minimal debian directory.
def _prependChangelogEntry(self, changelog_replacements):
Prepend a changelog entry in the current upstream directory.
def _runSubProcess(self, script, extra_args=None):
Run the given script and collects STDOUT and STDERR.
RaisesAssertionErrorIf the script returns a non-Zero value.
def _getChangefilePathForVersion(self, version, type='source'):
Return the changesfile path for a given (version, type).

'type' defaults to 'source' but can also be a architecturetag for binary uploads. It respects the context 'name'.

Return None if the specified upload could not be found.

def _doUpload(self, type, version, policy, archive, distribution_name, suite, logger, notify):
Upload a given version.

Raises an error if the version couldn't be found or the upload was rejected.

Build a upload policy with the given name and override it with archive, distribution_name and suite if passed.

Return the corresponding NascentUpload object.

def buildUpstream(self, suite='hoary', section=None, arch=None, build_orig=True):
Build a fake source upstream version.

This method should only be called once for a given upstream-{name, version}.

Parametersbuild_origboolean indicating whether or not to prepare a orig.tar.gz containing the pristine upstream code. If generated it can be used for subsequent versions.
RaisesAssertionErrorif there is already a upstream directory for the context upstream-{name, version}.
def buildVersion(self, version, changelog_text='nicht !', suite='hoary', section=None, arch=None, author='Foo Bar', email='foo.bar@canonical.com', timestamp=None):
Initialize a new version of extracted package.
def buildSource(self, include_orig=True, signed=True):
Build a new version of the source package.
Parametersinclude_origboolean, controls whether or not the upstream tarball should be included in the changesfile.
signedwhether or not to build a signed package.
RaisesAssertionErrorif the upstream directory is not available or if no GPG key was imported by this object.
def listAvailableUploads(self):
Return the path for all available changesfiles.
def uploadSourceVersion(self, version, policy='insecure', archive=None, distribution_name='ubuntu', suite=None, logger=None, notify=False, auto_accept=True):
Upload and publish a source package from the sandbox directory.

See _doUpload.

If 'auto_accept' is true, accept the upload if necessary and return the corresponding ISourcePackagePublishingHistory record. Otherwise return the corresponding NascentUpload object.

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