Bug 1243041 - Refine artifact platform selection based on target_cpu. r=nalexander

This commit is contained in:
Chris Manchester 2016-02-01 12:48:17 -08:00
parent eee98965f3
commit 9983c68ead
2 changed files with 23 additions and 23 deletions

View File

@ -59,6 +59,7 @@ import zipfile
import pylru
import taskcluster
import buildconfig
from mozbuild.util import (
ensureParentDir,
FileAvoidWrite,
@ -636,9 +637,9 @@ class ArtifactCache(CacheManager):
class Artifacts(object):
'''Maintain state to efficiently fetch build artifacts from a Firefox tree.'''
def __init__(self, tree, job, log=None, cache_dir='.', hg='hg'):
def __init__(self, tree, job=None, log=None, cache_dir='.', hg='hg'):
self._tree = tree
self._job = job
self._job = job or self._guess_artifact_job()
self._log = log
self._hg = hg
self._cache_dir = cache_dir
@ -667,6 +668,26 @@ class Artifacts(object):
if self._log:
self._log(*args, **kwargs)
def _guess_artifact_job(self):
if buildconfig.substs.get('MOZ_BUILD_APP', '') == 'mobile/android':
if self.substs['ANDROID_CPU_ARCH'] == 'x86':
return 'android-x86'
return 'android-api-15'
target_64bit = False
if buildconfig.substs['target_cpu'] == 'x86_64':
target_64bit = True
if buildconfig.defines.get('XP_LINUX', False):
return 'linux64' if target_64bit else 'linux'
if buildconfig.defines.get('XP_WIN', False):
return 'win64' if target_64bit else 'win32'
if buildconfig.defines.get('XP_MACOSX', False):
# We only produce unified builds in automation, so the target_cpu
# check is not relevant.
return 'macosx64'
raise Exception('Cannot determine default job for |mach artifact|!')
def _find_pushheads(self, parent):
# Return an ordered dict associating revisions that are pushheads with
# trees they are known to be in (starting with the first tree they're

View File

@ -1474,23 +1474,6 @@ class PackageFrontend(MachCommandBase):
artifacts = Artifacts(tree, job, log=self.log, cache_dir=cache_dir, hg=hg)
return artifacts
def _compute_platform(self, job=None):
if job:
return job
if self.substs.get('MOZ_BUILD_APP', '') == 'mobile/android':
if self.substs['ANDROID_CPU_ARCH'] == 'x86':
return 'android-x86'
return 'android-api-15'
# TODO: check for 32/64 bit builds. We'd like to use HAVE_64BIT_BUILD
# but that relies on the compile environment.
if self.defines.get('XP_LINUX', False):
return 'linux64'
if self.defines.get('XP_MACOSX', False):
return 'macosx64'
if self.defines.get('XP_WIN', False):
return 'win32'
raise Exception('Cannot determine default tree and job for |mach artifact|!')
@ArtifactSubCommand('artifact', 'install',
'Install a good pre-built artifact.')
@CommandArgument('source', metavar='SRC', nargs='?', type=str,
@ -1500,7 +1483,6 @@ class PackageFrontend(MachCommandBase):
default=None)
def artifact_install(self, source=None, tree=None, job=None, verbose=False):
self._set_log_level(verbose)
job = self._compute_platform(job)
artifacts = self._make_artifacts(tree=tree, job=job)
manifest_path = mozpath.join(self.topobjdir, '_build_manifests', 'install', 'dist_bin')
@ -1526,7 +1508,6 @@ class PackageFrontend(MachCommandBase):
'Print the last pre-built artifact installed.')
def artifact_print_last(self, tree=None, job=None, verbose=False):
self._set_log_level(verbose)
job = self._compute_platform(job)
artifacts = self._make_artifacts(tree=tree, job=job)
artifacts.print_last()
return 0
@ -1535,7 +1516,6 @@ class PackageFrontend(MachCommandBase):
'Print local artifact cache for debugging.')
def artifact_print_cache(self, tree=None, job=None, verbose=False):
self._set_log_level(verbose)
job = self._compute_platform(job)
artifacts = self._make_artifacts(tree=tree, job=job)
artifacts.print_cache()
return 0
@ -1544,7 +1524,6 @@ class PackageFrontend(MachCommandBase):
'Delete local artifacts and reset local artifact cache.')
def artifact_clear_cache(self, tree=None, job=None, verbose=False):
self._set_log_level(verbose)
job = self._compute_platform(job)
artifacts = self._make_artifacts(tree=tree, job=job)
artifacts.clear_cache()
return 0