summaryrefslogtreecommitdiff
path: root/python/mozbuild/mozbuild/mach_commands.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/mozbuild/mozbuild/mach_commands.py')
-rw-r--r--python/mozbuild/mozbuild/mach_commands.py150
1 files changed, 1 insertions, 149 deletions
diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py
index e299fca18..c4ee73345 100644
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -509,7 +509,7 @@ class Build(MachCommandBase):
# to avoid accidentally disclosing PII.
telemetry_data['substs'] = {}
try:
- for key in ['MOZ_ARTIFACT_BUILDS', 'MOZ_USING_CCACHE']:
+ for key in ['MOZ_USING_CCACHE']:
value = self.substs.get(key, False)
telemetry_data['substs'][key] = value
except BuildEnvironmentNotFoundException:
@@ -1477,154 +1477,6 @@ class MachDebug(MachCommandBase):
return json.JSONEncoder.default(self, obj)
json.dump(self, cls=EnvironmentEncoder, sort_keys=True, fp=out)
-class ArtifactSubCommand(SubCommand):
- def __call__(self, func):
- after = SubCommand.__call__(self, func)
- jobchoices = {
- 'linux',
- 'linux64',
- 'macosx64',
- 'win32',
- 'win64'
- }
- args = [
- CommandArgument('--tree', metavar='TREE', type=str,
- help='Firefox tree.'),
- CommandArgument('--job', metavar='JOB', choices=jobchoices,
- help='Build job.'),
- CommandArgument('--verbose', '-v', action='store_true',
- help='Print verbose output.'),
- ]
- for arg in args:
- after = arg(after)
- return after
-
-
-@CommandProvider
-class PackageFrontend(MachCommandBase):
- """Fetch and install binary artifacts from Mozilla automation."""
-
- @Command('artifact', category='post-build',
- description='Use pre-built artifacts to build Firefox.')
- def artifact(self):
- '''Download, cache, and install pre-built binary artifacts to build Firefox.
-
- Use |mach build| as normal to freshen your installed binary libraries:
- artifact builds automatically download, cache, and install binary
- artifacts from Mozilla automation, replacing whatever may be in your
- object directory. Use |mach artifact last| to see what binary artifacts
- were last used.
-
- Never build libxul again!
-
- '''
- pass
-
- def _set_log_level(self, verbose):
- self.log_manager.terminal_handler.setLevel(logging.INFO if not verbose else logging.DEBUG)
-
- def _install_pip_package(self, package):
- if os.environ.get('MOZ_AUTOMATION'):
- self.virtualenv_manager._run_pip([
- 'install',
- package,
- '--no-index',
- '--find-links',
- 'http://pypi.pub.build.mozilla.org/pub',
- '--trusted-host',
- 'pypi.pub.build.mozilla.org',
- ])
- return
- self.virtualenv_manager.install_pip_package(package)
-
- def _make_artifacts(self, tree=None, job=None, skip_cache=False):
- # Undo PATH munging that will be done by activating the virtualenv,
- # so that invoked subprocesses expecting to find system python
- # (git cinnabar, in particular), will not find virtualenv python.
- original_path = os.environ.get('PATH', '')
- self._activate_virtualenv()
- os.environ['PATH'] = original_path
-
- for package in ('taskcluster==0.0.32',
- 'mozregression==1.0.2'):
- self._install_pip_package(package)
-
- state_dir = self._mach_context.state_dir
- cache_dir = os.path.join(state_dir, 'package-frontend')
-
- try:
- os.makedirs(cache_dir)
- except OSError as e:
- if e.errno != errno.EEXIST:
- raise
-
- import which
-
- here = os.path.abspath(os.path.dirname(__file__))
- build_obj = MozbuildObject.from_environment(cwd=here)
-
- hg = None
- if conditions.is_hg(build_obj):
- if self._is_windows():
- hg = which.which('hg.exe')
- else:
- hg = which.which('hg')
-
- git = None
- if conditions.is_git(build_obj):
- if self._is_windows():
- git = which.which('git.exe')
- else:
- git = which.which('git')
-
- # Absolutely must come after the virtualenv is populated!
- from mozbuild.artifacts import Artifacts
- artifacts = Artifacts(tree, self.substs, self.defines, job,
- log=self.log, cache_dir=cache_dir,
- skip_cache=skip_cache, hg=hg, git=git,
- topsrcdir=self.topsrcdir)
- return artifacts
-
- @ArtifactSubCommand('artifact', 'install',
- 'Install a good pre-built artifact.')
- @CommandArgument('source', metavar='SRC', nargs='?', type=str,
- help='Where to fetch and install artifacts from. Can be omitted, in '
- 'which case the current hg repository is inspected; an hg revision; '
- 'a remote URL; or a local file.',
- default=None)
- @CommandArgument('--skip-cache', action='store_true',
- help='Skip all local caches to force re-fetching remote artifacts.',
- default=False)
- def artifact_install(self, source=None, skip_cache=False, tree=None, job=None, verbose=False):
- self._set_log_level(verbose)
- artifacts = self._make_artifacts(tree=tree, job=job, skip_cache=skip_cache)
-
- return artifacts.install_from(source, self.distdir)
-
- @ArtifactSubCommand('artifact', 'last',
- 'Print the last pre-built artifact installed.')
- def artifact_print_last(self, tree=None, job=None, verbose=False):
- self._set_log_level(verbose)
- artifacts = self._make_artifacts(tree=tree, job=job)
- artifacts.print_last()
- return 0
-
- @ArtifactSubCommand('artifact', 'print-cache',
- 'Print local artifact cache for debugging.')
- def artifact_print_cache(self, tree=None, job=None, verbose=False):
- self._set_log_level(verbose)
- artifacts = self._make_artifacts(tree=tree, job=job)
- artifacts.print_cache()
- return 0
-
- @ArtifactSubCommand('artifact', 'clear-cache',
- 'Delete local artifacts and reset local artifact cache.')
- def artifact_clear_cache(self, tree=None, job=None, verbose=False):
- self._set_log_level(verbose)
- artifacts = self._make_artifacts(tree=tree, job=job)
- artifacts.clear_cache()
- return 0
-
@CommandProvider
class Vendor(MachCommandBase):
"""Vendor third-party dependencies into the source repository."""