mozharness.mozilla package

Submodules

mozharness.mozilla.blob_upload module

class mozharness.mozilla.blob_upload.BlobUploadMixin(*args, **kwargs)[source]

Bases: mozharness.base.python.VirtualenvMixin

Provides mechanism to automatically upload files written in MOZ_UPLOAD_DIR to the blobber upload server at the end of the running script.

This is dependent on ScriptMixin and BuildbotMixin. The testing script inheriting this class is to specify as cmdline options the <blob-upload-branch> and <blob-upload-server>

upload_blobber_files()[source]

mozharness.mozilla.buildbot module

Code to tie into buildbot. Ideally this will go away if and when we retire buildbot.

class mozharness.mozilla.buildbot.BuildbotMixin[source]

Bases: object

buildbot_config = None
buildbot_properties = {}
buildbot_status(tbpl_status, level=None, set_return_code=True)[source]
dump_buildbot_properties(prop_list=None, file_name='properties', error_level='error')[source]
invoke_sendchange(downloadables=None, branch=None, username='sendchange-unittest', sendchange_props=None)[source]

Generic sendchange, currently b2g- and unittest-specific.

query_buildbot_property(prop_name)[source]
query_is_nightly()[source]

returns whether or not the script should run as a nightly build.

First will check for ‘nightly_build’ in self.config and if that is not True, we will also allow buildbot_config to determine for us. Failing all of that, we default to False. Note, dependancy on buildbot_config is being deprecated. Putting everything in self.config is the preference.

read_buildbot_config()[source]
set_buildbot_property(prop_name, prop_value, write_to_file=False)[source]
tryserver_email()[source]
worst_buildbot_status = 'SUCCESS'

mozharness.mozilla.gaia module

Module for performing gaia-specific tasks

class mozharness.mozilla.gaia.GaiaMixin[source]

Bases: object

clone_gaia(dest, repo, use_gaia_json=False)[source]

Clones an hg mirror of gaia.

repo: a dict containing ‘repo_path’, ‘revision’, and optionally
‘branch’ parameters
use_gaia_json: if True, the repo parameter is used to retrieve
a gaia.json file from a gecko repo, which in turn is used to clone gaia; if False, repo represents a gaia repo to clone.
extract_xre(xre_url, xre_path=None, parent_dir=None)[source]
make_gaia(gaia_dir, xre_dir, debug=False, noftu=True, xre_url=None, build_config_path=None)[source]
make_node_modules()[source]
node_setup()[source]

Set up environment for node-based Gaia tests.

npm_error_list = [{'substr': 'command not found', 'level': 'error'}, {'substr': 'npm ERR! Error:', 'level': 'error'}]
preflight_pull()[source]
pull(**kwargs)[source]

Two ways of using this function: - The user specifies –gaia-repo or in a config file - The buildbot propeties exist and we query the gaia json url

for the current gecko tree

mozharness.mozilla.mapper module

Support for hg/git mapper

class mozharness.mozilla.mapper.MapperMixin[source]
query_mapper(mapper_url, project, vcs, rev, require_answer=True, attempts=30, sleeptime=30, project_name=None)[source]

Returns the mapped revision for the target vcs via a mapper service

Args:

mapper_url (str): base url to use for the mapper service project (str): The name of the mapper project to use for lookups vcs (str): Which vcs you want the revision for. e.g. “git” to get

the git revision given an hg revision

rev (str): The original revision you want the mapping for. require_answer (bool): Whether you require a valid answer or not.

If None is acceptable (meaning mapper doesn’t know about the revision you’re asking about), then set this to False. If True, then will return the revision, or cause a fatal error.

attempts (int): How many times to try to do the lookup sleeptime (int): How long to sleep between attempts project_name (str): Used for logging only to give a more

descriptive name to the project, otherwise just uses the project parameter
Returns:
A revision string, or None
query_mapper_git_revision(url, project, rev, **kwargs)[source]

Returns the git revision for the given hg revision rev See query_mapper docs for supported parameters and docstrings

query_mapper_hg_revision(url, project, rev, **kwargs)[source]

Returns the hg revision for the given git revision rev See query_mapper docs for supported parameters and docstrings

mozharness.mozilla.mock module

Code to integrate with mock

class mozharness.mozilla.mock.MockMixin[source]

Bases: object

Provides methods to setup and interact with mock environments. https://wiki.mozilla.org/ReleaseEngineering/Applications/Mock

This is dependent on ScriptMixin

copy_mock_files(mock_target, files)[source]

Copy files into the mock environment mock_target. files should be an iterable of 2-tuples: (src, dst)

default_mock_target = None
delete_mock_files(mock_target, files)[source]

Delete files from the mock environment mock_target. files should be an iterable of 2-tuples: (src, dst). Only the dst component is deleted.

disable_mock()[source]

Restore self.run_command and self.get_output_from_command to their original versions. This is the opposite of self.enable_mock()

done_mock_setup = False
enable_mock()[source]

Wrap self.run_command and self.get_output_from_command to run inside the mock environment given by self.config[‘mock_target’]

get_mock_output_from_command(mock_target, command, cwd=None, env=None, **kwargs)[source]

Same as ScriptMixin.get_output_from_command, except runs command inside mock environment mock_target.

get_mock_target()[source]
get_output_from_command_m(*args, **kwargs)[source]

Executes self.get_mock_output_from_command if we have a mock target set, otherwise executes self.get_output_from_command.

init_mock(mock_target)[source]

Initialize mock environment defined by mock_target

install_mock_packages(mock_target, packages)[source]

Install packages into mock environment mock_target

mock_enabled = False
reset_mock(mock_target=None)[source]

rm mock lock and reset

run_command_m(*args, **kwargs)[source]

Executes self.run_mock_command if we have a mock target set, otherwise executes self.run_command.

run_mock_command(mock_target, command, cwd=None, env=None, **kwargs)[source]

Same as ScriptMixin.run_command, except runs command inside mock environment mock_target.

setup_mock(mock_target=None, mock_packages=None, mock_files=None)[source]

Initializes and installs packages, copies files into mock environment given by configuration in self.config. The mock environment is given by self.config[‘mock_target’], the list of packges to install given by self.config[‘mock_packages’], and the list of files to copy in is self.config[‘mock_files’].

mozharness.mozilla.mozbase module

class mozharness.mozilla.mozbase.MozbaseMixin(*args, **kwargs)[source]

Bases: object

Automatically set virtualenv requirements to use mozbase from test package.

mozharness.mozilla.purge module

Purge/clobber support

class mozharness.mozilla.purge.PurgeMixin[source]

Bases: object

clobber(always_clobber_dirs=None)[source]

Mozilla clobberer-type clobber.

clobber_tool = '/home/docs/checkouts/readthedocs.org/user_builds/moz-releng-mozharness/checkouts/latest/external_tools/clobberer.py'
clobberer()[source]
default_maxage = 14
default_periodic_clobber = 168
default_skips = ['info', 'rel-*', 'tb-rel-*']
purge_builds(basedirs=None, min_size=None, skip=None, max_age=None)[source]
purge_tool = '/home/docs/checkouts/readthedocs.org/user_builds/moz-releng-mozharness/checkouts/latest/external_tools/purge_builds.py'

mozharness.mozilla.release module

release.py

class mozharness.mozilla.release.ReleaseMixin[source]
query_release_config()[source]
release_config = {}

mozharness.mozilla.repo_manifest module

Module for handling repo style XML manifests

mozharness.mozilla.repo_manifest.add_project(manifest, name, path, remote=None, revision=None)[source]

Adds a project to the manifest in place

mozharness.mozilla.repo_manifest.cleanup(manifest, depth=0)[source]

Remove any empty text nodes

mozharness.mozilla.repo_manifest.get_default(manifest)[source]
mozharness.mozilla.repo_manifest.get_project(manifest, name=None, path=None)[source]

Gets a project node from the manifest. One of name or path must be set. If path is specified, then the project with the given path is returned, otherwise the project with the given name is returned.

mozharness.mozilla.repo_manifest.get_project_remote_url(manifest, project)[source]

Gets the remote URL for the given project node. Will return the default remote if the project doesn’t explicitly specify one.

mozharness.mozilla.repo_manifest.get_project_revision(manifest, project)[source]

Gets the revision for the given project node. Will return the default revision if the project doesn’t explicitly specify one.

mozharness.mozilla.repo_manifest.get_remote(manifest, name)[source]
mozharness.mozilla.repo_manifest.is_commitid(revision)[source]

Returns True if revision looks like a commit id i.e. 40 character string made up of 0-9a-f

mozharness.mozilla.repo_manifest.load_manifest(filename)[source]

Loads manifest from filename and returns a single flattened manifest Processes any <include name=”...” /> nodes recursively Removes projects referenced by <remove-project name=”...” /> nodes Abort on unsupported manifest tags Returns the root node of the resulting DOM

mozharness.mozilla.repo_manifest.map_remote(r, mappings)[source]

Helper function for mapping git remotes

mozharness.mozilla.repo_manifest.remove_group(manifest, group)[source]

Removes all projects with groups=`group`

mozharness.mozilla.repo_manifest.remove_project(manifest, name=None, path=None)[source]

Removes a project from manifest. One of name or path must be set. If path is specified, then the project with the given path is removed, otherwise the project with the given name is removed.

mozharness.mozilla.repo_manifest.rewrite_remotes(manifest, mapping_func, force_all=True)[source]

Rewrite manifest remotes in place Returns the same manifest, with the remotes transformed by mapping_func mapping_func should return a modified remote node, or None if no changes are required If force_all is True, then it is an error for mapping_func to return None; a ValueError is raised in this case

mozharness.mozilla.signing module

Mozilla-specific signing methods.

class mozharness.mozilla.signing.MobileSigningMixin[source]

Bases: mozharness.base.signing.AndroidSigningMixin, mozharness.mozilla.signing.SigningMixin

verify_android_signature(apk, script=None, key_alias='nightly', tools_dir='tools/', env=None)[source]

Runs mjessome’s android signature verification script. This currently doesn’t check to see if the apk exists; you may want to do that before calling the method.

class mozharness.mozilla.signing.SigningMixin[source]

Bases: mozharness.base.signing.BaseSigningMixin

Generic signing helper methods.

query_moz_sign_cmd(formats='gpg')[source]

mozharness.mozilla.tooltool module

module for tooltool operations

class mozharness.mozilla.tooltool.TooltoolMixin[source]

Bases: object

Mixin class for handling tooltool manifests. To use a tooltool server other than the Mozilla server, override config[‘tooltool_servers’]. To specify a different authentication file than that used in releng automation,override config[‘tooltool_authentication_file’]; set it to None to not pass any authentication information (OK for public files)

create_tooltool_manifest(contents, path=None)[source]

Currently just creates a manifest, given the contents. We may want a template and individual values in the future?

tooltool_fetch(manifest, bootstrap_cmd=None, output_dir=None, privileged=False, cache=None)[source]

docstring for tooltool_fetch

Module contents