mozbuild.action package¶
Submodules¶
mozbuild.action.buildlist module¶
A generic script to add entries to a file if the entry does not already exist.
Usage: buildlist.py <filename> <entry> [<entry> …]
- mozbuild.action.buildlist.addEntriesToListFile(listFile, entries)¶
Given a file |listFile| containing one entry per line, add each entry in |entries| to the file, unless it is already present.
- mozbuild.action.buildlist.main(args)¶
mozbuild.action.check_binary module¶
mozbuild.action.dumpsymbols module¶
- mozbuild.action.dumpsymbols.dump_symbols(target, tracking_file, count_ctors=False)¶
- mozbuild.action.dumpsymbols.main(argv)¶
mozbuild.action.exe_7z_archive module¶
- mozbuild.action.exe_7z_archive.archive_exe(pkg_dir, tagfile, sfx_package, package, use_upx)¶
- mozbuild.action.exe_7z_archive.main(args)¶
mozbuild.action.fat_aar module¶
Fetch and unpack architecture-specific Maven zips, verify cross-architecture compatibility, and ready inputs to an Android multi-architecture fat AAR build.
- mozbuild.action.fat_aar.fat_aar(distdir, aars_paths, no_process=False, no_compatibility_check=False)¶
- mozbuild.action.fat_aar.main(argv)¶
mozbuild.action.generate_searchjson module¶
mozbuild.action.generate_symbols_file module¶
- mozbuild.action.generate_symbols_file.generate_symbols_file(output, *args)¶
mozbuild.action.langpack_manifest module¶
- mozbuild.action.langpack_manifest.build_author_string(author, contributors)¶
- mozbuild.action.langpack_manifest.convert_contributors(str)¶
- mozbuild.action.langpack_manifest.convert_entry_flags_to_platform_codes(flags)¶
- mozbuild.action.langpack_manifest.create_webmanifest(locstr, version, min_app_ver, max_app_ver, app_name, l10n_basedir, langpack_eid, defines, chrome_entries)¶
- mozbuild.action.langpack_manifest.get_dt_from_hg(path)¶
- mozbuild.action.langpack_manifest.get_timestamp_for_locale(path)¶
- mozbuild.action.langpack_manifest.get_version_maybe_buildid(version)¶
- mozbuild.action.langpack_manifest.main(args)¶
- mozbuild.action.langpack_manifest.parse_chrome_manifest(path, base_path, chrome_entries)¶
- mozbuild.action.langpack_manifest.parse_defines(paths)¶
- mozbuild.action.langpack_manifest.write_file(path, content)¶
mozbuild.action.make_unzip module¶
- mozbuild.action.make_unzip.main(args)¶
- mozbuild.action.make_unzip.make_unzip(package)¶
mozbuild.action.make_zip module¶
- mozbuild.action.make_zip.main(args)¶
- mozbuild.action.make_zip.make_zip(source, package)¶
mozbuild.action.node module¶
- mozbuild.action.node.execute_node_cmd(node_cmd_list)¶
Execute the given node command list.
Arguments: node_cmd_list – a list of the command and arguments to be executed
Returns: The set of dependencies which should trigger this command to be re-run. This is ultimately returned to the build system for use by the backend to ensure that incremental rebuilds happen when any dependency changes.
The node script is expected to output lines for all of the dependencies to stdout, each prefixed by the string “dep:”. These lines will make up the returned set of dependencies. Any line not so-prefixed will simply be printed to stderr instead.
- mozbuild.action.node.generate(output, node_script, *files)¶
Call the given node_script to transform the given modules.
Arguments: output – a dummy file, used by the build system. Can be ignored. node_script – the script to be executed. Must be in the SCRIPT_ALLOWLIST files – files to be transformed, will be passed to the script as arguments
Returns: The set of dependencies which should trigger this command to be re-run. This is ultimately returned to the build system for use by the backend to ensure that incremental rebuilds happen when any dependency changes.
- mozbuild.action.node.is_script_in_allowlist(script_path)¶
mozbuild.action.output_searchplugins_list module¶
mozbuild.action.package_generated_sources module¶
- mozbuild.action.package_generated_sources.main(argv)¶
mozbuild.action.preprocessor module¶
- mozbuild.action.preprocessor.generate(output, *args)¶
- mozbuild.action.preprocessor.main(args)¶
mozbuild.action.process_define_files module¶
- mozbuild.action.process_define_files.main(argv)¶
- mozbuild.action.process_define_files.process_define_file(output, input)¶
Creates the given config header. A config header is generated by taking the corresponding source file and replacing some #define/#undef occurences:
“#undef NAME” is turned into “#define NAME VALUE” “#define NAME” is unchanged “#define NAME ORIGINAL_VALUE” is turned into “#define NAME VALUE” “#undef UNKNOWN_NAME” is turned into “/* #undef UNKNOWN_NAME */” Whitespaces are preserved.
As a special rule, “#undef ALLDEFINES” is turned into “#define NAME VALUE” for all the defined variables.
mozbuild.action.process_install_manifest module¶
- mozbuild.action.process_install_manifest.main(argv)¶
- mozbuild.action.process_install_manifest.process_manifest(destdir, paths, track, no_symlinks=False, defines={})¶
mozbuild.action.symbols_archive module¶
- mozbuild.action.symbols_archive.main(argv)¶
- mozbuild.action.symbols_archive.make_archive(archive_name, base, exclude, include)¶
mozbuild.action.test_archive module¶
mozbuild.action.tooltool module¶
- exception mozbuild.action.tooltool.BadFilenameException(filename)¶
- exception mozbuild.action.tooltool.BadHeaderValue¶
Bases:
Exception
- exception mozbuild.action.tooltool.DigestMismatchException(filename)¶
- exception mozbuild.action.tooltool.ExceptionWithFilename(filename)¶
Bases:
Exception
- class mozbuild.action.tooltool.FileRecord(filename, size, digest, algorithm, unpack=False, version=None, visibility=None)¶
Bases:
object
- describe()¶
- present()¶
- validate()¶
- validate_digest()¶
- validate_size()¶
- class mozbuild.action.tooltool.FileRecordJSONDecoder(*, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, strict=True, object_pairs_hook=None)¶
Bases:
json.decoder.JSONDecoder
I help the json module materialize a FileRecord from a JSON file. I understand FileRecords and lists of FileRecords. I ignore things that I don’t expect for now
- decode(s)¶
Return the Python representation of
s
(astr
instance containing a JSON document).
- process_file_records(obj)¶
- class mozbuild.action.tooltool.FileRecordJSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)¶
Bases:
json.encoder.JSONEncoder
- default(f)¶
Implement this method in a subclass such that it returns a serializable object for
o
, or calls the base implementation (to raise aTypeError
).For example, to support arbitrary iterators, you could implement default like this:
def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o)
- encode_file_record(obj)¶
- exception mozbuild.action.tooltool.FileRecordJSONEncoderException¶
Bases:
Exception
- exception mozbuild.action.tooltool.InvalidCredentials¶
Bases:
Exception
- exception mozbuild.action.tooltool.InvalidManifest¶
Bases:
Exception
- class mozbuild.action.tooltool.Manifest(file_records=None)¶
Bases:
object
- copy()¶
- dump(output_file, fmt='json')¶
- dumps(fmt='json')¶
- load(data_file, fmt='json')¶
- loads(data_string, fmt='json')¶
- present()¶
- valid_formats = ('json',)¶
- validate()¶
- validate_digests()¶
- validate_sizes()¶
- exception mozbuild.action.tooltool.MissingFileException(filename)¶
- mozbuild.action.tooltool.add_files(manifest_file, algorithm, filenames, version, visibility, unpack)¶
- mozbuild.action.tooltool.calculate_mac(mac_type, access_token, algorithm, timestamp, nonce, method, name, host, port, content_hash)¶
- mozbuild.action.tooltool.calculate_payload_hash(algorithm, payload, content_type)¶
- mozbuild.action.tooltool.change_visibility(base_urls, digest, visibility, auth_file)¶
- mozbuild.action.tooltool.clean_path(dirname)¶
Remove a subtree if is exists. Helper for unpack_file().
- mozbuild.action.tooltool.create_file_record(filename, algorithm)¶
- mozbuild.action.tooltool.delete_instances(base_urls, digest, auth_file)¶
- mozbuild.action.tooltool.digest_file(f, a)¶
I take a file like object ‘f’ and return a hex-string containing of the result of the algorithm ‘a’ applied to ‘f’.
- mozbuild.action.tooltool.execute(cmd)¶
Execute CMD, logging its stdout at the info level
- mozbuild.action.tooltool.fetch_file(base_urls, file_record, grabchunk=4096, auth_file=None, region=None)¶
- mozbuild.action.tooltool.fetch_files(manifest_file, base_urls, filenames=[], cache_folder=None, auth_file=None, region=None)¶
- mozbuild.action.tooltool.freespace(p)¶
Returns the number of bytes free under directory p
- mozbuild.action.tooltool.get_hexdigest(val)¶
- mozbuild.action.tooltool.list_manifest(manifest_file)¶
I know how print all the files in a location
- mozbuild.action.tooltool.main(argv, _skip_logging=False)¶
- mozbuild.action.tooltool.make_taskcluster_header(credentials, req)¶
- mozbuild.action.tooltool.normalize_header_attr(val)¶
- mozbuild.action.tooltool.normalize_string(mac_type, timestamp, nonce, method, name, host, port, content_hash)¶
- mozbuild.action.tooltool.open_manifest(manifest_file)¶
I know how to take a filename and load it into a Manifest object
- mozbuild.action.tooltool.parse_content_type(content_type)¶
- mozbuild.action.tooltool.parse_url(url)¶
- mozbuild.action.tooltool.prepare_header_val(val)¶
- mozbuild.action.tooltool.process_command(options, args)¶
I know how to take a list of program arguments and start doing the right thing with them
- mozbuild.action.tooltool.purge(folder, gigs)¶
If gigs is non 0, it deletes files in folder until gigs GB are free, starting from older files. If gigs is 0, a full purge will be performed. No recursive deletion of files in subfolder is performed.
- mozbuild.action.tooltool.random() x in the interval [0, 1). ¶
- mozbuild.action.tooltool.random_string(length)¶
- mozbuild.action.tooltool.request(url, auth_file=None)¶
- mozbuild.action.tooltool.request_has_data(req)¶
- mozbuild.action.tooltool.retriable(*retry_args, **retry_kwargs)¶
This function originates from redo 2.0.3 https://github.com/mozilla-releng/redo A decorator factory for retry(). Wrap your function in @retriable(…) to give it retry powers!
- mozbuild.action.tooltool.retrier(attempts=5, sleeptime=10, max_sleeptime=300, sleepscale=1.5, jitter=1)¶
This function originates from redo 2.0.3 https://github.com/mozilla-releng/redo A generator function that sleeps between retries, handles exponential backoff and jitter. The action you are retrying is meant to run after retrier yields.
- mozbuild.action.tooltool.retry(action, attempts=5, sleeptime=60, max_sleeptime=300, sleepscale=1.5, jitter=1, retry_exceptions=(<class 'Exception'>, ), cleanup=None, args=(), kwargs={}, log_args=True)¶
This function originates from redo 2.0.3 https://github.com/mozilla-releng/redo Calls an action function until it succeeds, or we give up.
- mozbuild.action.tooltool.send_operation_on_file(data, base_urls, digest, auth_file)¶
- mozbuild.action.tooltool.touch(f)¶
Used to modify mtime in cached files; mtime is used by the purge command
- mozbuild.action.tooltool.unpack_file(filename)¶
Untar filename, assuming it is uncompressed or compressed with bzip2, xz, gzip, zst, or unzip a zip file. The file is assumed to contain a single directory with a name matching the base of the given filename. Xz support is handled by shelling out to ‘tar’.
- mozbuild.action.tooltool.upload(manifest, message, base_urls, auth_file, region)¶
- mozbuild.action.tooltool.utc_now(offset_in_seconds=0.0)¶
- mozbuild.action.tooltool.validate_manifest(manifest_file)¶
I validate that all files in a manifest are present and valid but don’t fetch or delete them if they aren’t
- mozbuild.action.tooltool.validate_taskcluster_credentials(credentials)¶
mozbuild.action.unify_symbols module¶
- class mozbuild.action.unify_symbols.UnifiedSymbolsFinder(finder1, finder2, sorted=[], **kargs)¶
Bases:
mozpack.unify.UnifiedFinder
- unify_file(path, file1, file2)¶
Given two BaseFiles and the path they were found at, return a unified version of the files. If the files match, the first BaseFile may be returned. If the files don’t match or one of them is None, the method returns None. Subclasses may decide to unify by using one of the files in that case.
- mozbuild.action.unify_symbols.main()¶
mozbuild.action.unify_tests module¶
- class mozbuild.action.unify_tests.UnifiedTestFinder(finder1, finder2, sorted=[], **kargs)¶
Bases:
mozpack.unify.UnifiedFinder
- unify_file(path, file1, file2)¶
Given two BaseFiles and the path they were found at, return a unified version of the files. If the files match, the first BaseFile may be returned. If the files don’t match or one of them is None, the method returns None. Subclasses may decide to unify by using one of the files in that case.
- mozbuild.action.unify_tests.main()¶
mozbuild.action.util module¶
- mozbuild.action.util.log_build_task(f, *args, **kwargs)¶
Run the given function, representing an entire build task, and log the BUILDTASK metadata row to stdout.
mozbuild.action.webidl module¶
- mozbuild.action.webidl.main(argv)¶
Perform WebIDL code generation required by the build system.
mozbuild.action.wrap_rustc module¶
- mozbuild.action.wrap_rustc.parse_outputs(crate_output, dep_outputs, pass_l_flag)¶
- mozbuild.action.wrap_rustc.wrap_rustc(args)¶
mozbuild.action.xpccheck module¶
A generic script to verify all test files are in the corresponding .ini file.
Usage: xpccheck.py <directory> [<directory> …]
- mozbuild.action.xpccheck.getIniTests(testdir)¶
- mozbuild.action.xpccheck.main(argv)¶
- mozbuild.action.xpccheck.verifyDirectory(initests, directory)¶
- mozbuild.action.xpccheck.verifyIniFile(initests, directory)¶