зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 6 changesets (bug 1377216) for SM(pkg) bustage on a CLOSED TREE.
Backed out changeset b5701f3ce506 (bug 1377216) Backed out changeset 1f37aebe0f43 (bug 1377216) Backed out changeset c8931588f674 (bug 1377216) Backed out changeset ded5328ba74c (bug 1377216) Backed out changeset 6cb234539746 (bug 1377216) Backed out changeset ce836965fd58 (bug 1377216)
This commit is contained in:
Родитель
67a23f8462
Коммит
741a7a5ea3
|
@ -309,86 +309,6 @@ def shell(value, mozillabuild):
|
|||
return find_program(shell)
|
||||
|
||||
|
||||
# Source checkout and version control integration.
|
||||
# ================================================
|
||||
|
||||
@depends(check_build_environment, 'MOZ_AUTOMATION')
|
||||
@checking('for vcs source checkout')
|
||||
@imports('os')
|
||||
def vcs_checkout_type(build_env, automation):
|
||||
if os.path.exists(os.path.join(build_env.topsrcdir, '.hg')):
|
||||
return 'hg'
|
||||
elif os.path.exists(os.path.join(build_env.topsrcdir, '.git')):
|
||||
return 'git'
|
||||
elif automation:
|
||||
raise FatalCheckError('unable to resolve VCS type; must run '
|
||||
'from a source checkout when MOZ_AUTOMATION '
|
||||
'is set')
|
||||
|
||||
# Resolve VCS binary for detected repository type.
|
||||
hg = check_prog('HG', ('hg',), allow_missing=True,
|
||||
when=depends(vcs_checkout_type)(lambda x: x == 'hg'))
|
||||
git = check_prog('GIT', ('git',), allow_missing=True,
|
||||
when=depends(vcs_checkout_type)(lambda x: x == 'git'))
|
||||
|
||||
@depends_if(hg)
|
||||
@checking('for Mercurial version')
|
||||
@imports('os')
|
||||
@imports('re')
|
||||
def hg_version(hg):
|
||||
# HGPLAIN in Mercurial 1.5+ forces stable output, regardless of set
|
||||
# locale or encoding.
|
||||
env = dict(os.environ)
|
||||
env['HGPLAIN'] = '1'
|
||||
|
||||
out = check_cmd_output(hg, '--version', env=env)
|
||||
|
||||
match = re.search(r'Mercurial Distributed SCM \(version ([^\)]+)', out)
|
||||
|
||||
if not match:
|
||||
raise FatalCheckError('unable to determine Mercurial version: %s' % out)
|
||||
|
||||
# The version string may be "unknown" for Mercurial run out of its own
|
||||
# source checkout or for bad builds. But LooseVersion handles it.
|
||||
|
||||
return Version(match.group(1))
|
||||
|
||||
@depends_if(git)
|
||||
@checking('for Git version')
|
||||
@imports('re')
|
||||
def git_version(git):
|
||||
out = check_cmd_output(git, '--version').rstrip()
|
||||
|
||||
match = re.search('git version (.*)$', out)
|
||||
|
||||
if not match:
|
||||
raise FatalCheckError('unable to determine Git version: %s' % out)
|
||||
|
||||
return Version(match.group(1))
|
||||
|
||||
# Only set VCS_CHECKOUT_TYPE if we resolved the VCS binary.
|
||||
# Require resolved VCS info when running in automation so automation's
|
||||
# environment is more well-defined.
|
||||
@depends(vcs_checkout_type, hg_version, git_version, 'MOZ_AUTOMATION')
|
||||
def exposed_vcs_checkout_type(vcs_checkout_type, hg, git, automation):
|
||||
if vcs_checkout_type == 'hg':
|
||||
if hg:
|
||||
return 'hg'
|
||||
|
||||
if automation:
|
||||
raise FatalCheckError('could not resolve Mercurial binary info')
|
||||
|
||||
elif vcs_checkout_type == 'git':
|
||||
if git:
|
||||
return 'git'
|
||||
|
||||
if automation:
|
||||
raise FatalCheckError('could not resolve Git binary info')
|
||||
elif vcs_checkout_type:
|
||||
raise FatalCheckError('unhandled VCS type: %s' % vcs_checkout_type)
|
||||
|
||||
set_config('VCS_CHECKOUT_TYPE', exposed_vcs_checkout_type)
|
||||
|
||||
# Host and target systems
|
||||
# ==============================================================
|
||||
option('--host', nargs=1, help='Define the system type performing the build')
|
||||
|
|
|
@ -22,7 +22,6 @@ def configure_error(message):
|
|||
# by running the given command if it exits normally, and streams that
|
||||
# output to log.debug and calls die or the given error callback if it
|
||||
# does not.
|
||||
@imports(_from='__builtin__', _import='unicode')
|
||||
@imports('subprocess')
|
||||
@imports('sys')
|
||||
@imports(_from='mozbuild.configure.util', _import='LineIO')
|
||||
|
@ -30,26 +29,10 @@ def configure_error(message):
|
|||
def check_cmd_output(*args, **kwargs):
|
||||
onerror = kwargs.pop('onerror', None)
|
||||
|
||||
# subprocess on older Pythons can't handle unicode keys or values in
|
||||
# environment dicts. Normalize automagically so callers don't have to
|
||||
# deal with this.
|
||||
if 'env' in kwargs:
|
||||
normalized_env = {}
|
||||
for k, v in kwargs['env'].items():
|
||||
if isinstance(k, unicode):
|
||||
k = k.encode('utf-8', 'strict')
|
||||
|
||||
if isinstance(v, unicode):
|
||||
v = v.encode('utf-8', 'strict')
|
||||
|
||||
normalized_env[k] = v
|
||||
|
||||
kwargs['env'] = normalized_env
|
||||
|
||||
with log.queue_debug():
|
||||
log.debug('Executing: `%s`', quote(*args))
|
||||
proc = subprocess.Popen(args, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE, **kwargs)
|
||||
stderr=subprocess.PIPE)
|
||||
stdout, stderr = proc.communicate()
|
||||
retcode = proc.wait()
|
||||
if retcode == 0:
|
||||
|
|
|
@ -751,12 +751,24 @@ class MachCommandConditions(object):
|
|||
@staticmethod
|
||||
def is_hg(cls):
|
||||
"""Must have a mercurial source checkout."""
|
||||
return getattr(cls, 'substs', {}).get('VCS_CHECKOUT_TYPE') == 'hg'
|
||||
if hasattr(cls, 'substs'):
|
||||
top_srcdir = cls.substs.get('top_srcdir')
|
||||
elif hasattr(cls, 'topsrcdir'):
|
||||
top_srcdir = cls.topsrcdir
|
||||
else:
|
||||
return False
|
||||
return top_srcdir and os.path.isdir(os.path.join(top_srcdir, '.hg'))
|
||||
|
||||
@staticmethod
|
||||
def is_git(cls):
|
||||
"""Must have a git source checkout."""
|
||||
return getattr(cls, 'substs', {}).get('VCS_CHECKOUT_TYPE') == 'git'
|
||||
if hasattr(cls, 'substs'):
|
||||
top_srcdir = cls.substs.get('top_srcdir')
|
||||
elif hasattr(cls, 'topsrcdir'):
|
||||
top_srcdir = cls.topsrcdir
|
||||
else:
|
||||
return False
|
||||
return top_srcdir and os.path.exists(os.path.join(top_srcdir, '.git'))
|
||||
|
||||
|
||||
class PathArgument(object):
|
||||
|
|
|
@ -1629,16 +1629,24 @@ class PackageFrontend(MachCommandBase):
|
|||
state_dir = self._mach_context.state_dir
|
||||
cache_dir = os.path.join(state_dir, 'package-frontend')
|
||||
|
||||
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):
|
||||
hg = build_obj.substs['HG']
|
||||
if self._is_windows():
|
||||
hg = which.which('hg.exe')
|
||||
else:
|
||||
hg = which.which('hg')
|
||||
|
||||
git = None
|
||||
if conditions.is_git(build_obj):
|
||||
git = build_obj.substs['GIT']
|
||||
if self._is_windows():
|
||||
git = which.which('git.exe')
|
||||
else:
|
||||
git = which.which('git')
|
||||
|
||||
from mozbuild.artifacts import Artifacts
|
||||
artifacts = Artifacts(tree, self.substs, self.defines, job,
|
||||
|
|
|
@ -13,9 +13,6 @@ from distutils.version import LooseVersion
|
|||
|
||||
def get_tool_path(tool):
|
||||
"""Obtain the path of `tool`."""
|
||||
if os.path.isabs(tool) and os.path.exists(tool):
|
||||
return tool
|
||||
|
||||
# We use subprocess in places, which expects a Win32 executable or
|
||||
# batch script. On some versions of MozillaBuild, we have "hg.exe",
|
||||
# "hg.bat," and "hg" (a Python script). "which" will happily return the
|
||||
|
@ -86,8 +83,8 @@ class Repository(object):
|
|||
|
||||
class HgRepository(Repository):
|
||||
'''An implementation of `Repository` for Mercurial repositories.'''
|
||||
def __init__(self, path, hg='hg'):
|
||||
super(HgRepository, self).__init__(path, tool=hg)
|
||||
def __init__(self, path):
|
||||
super(HgRepository, self).__init__(path, 'hg')
|
||||
self._env[b'HGPLAIN'] = b'1'
|
||||
|
||||
def get_modified_files(self):
|
||||
|
@ -115,8 +112,8 @@ class HgRepository(Repository):
|
|||
|
||||
class GitRepository(Repository):
|
||||
'''An implementation of `Repository` for Git repositories.'''
|
||||
def __init__(self, path, git='git'):
|
||||
super(GitRepository, self).__init__(path, tool=git)
|
||||
def __init__(self, path):
|
||||
super(GitRepository, self).__init__(path, 'git')
|
||||
|
||||
def get_modified_files(self):
|
||||
return self._run('diff', '--diff-filter=M', '--name-only').splitlines()
|
||||
|
@ -151,47 +148,8 @@ def get_repository_object(path):
|
|||
path)
|
||||
|
||||
|
||||
class MissingVCSInfo(Exception):
|
||||
"""Represents a general failure to resolve a VCS interface."""
|
||||
|
||||
|
||||
class MissingConfigureInfo(MissingVCSInfo):
|
||||
"""Represents error finding VCS info from configure data."""
|
||||
|
||||
|
||||
def get_repository_from_env():
|
||||
"""Obtain a repository object by looking at the environment.
|
||||
|
||||
If inside a build environment (denoted by presence of a ``buildconfig``
|
||||
module), VCS info is obtained from it, as found via configure. This allows
|
||||
us to respect what was passed into configure. Otherwise, we fall back to
|
||||
scanning the filesystem.
|
||||
"""
|
||||
try:
|
||||
import buildconfig
|
||||
|
||||
flavor = buildconfig.substs.get('VCS_CHECKOUT_TYPE')
|
||||
|
||||
# If in build mode, only use what configure found. That way we ensure
|
||||
# that everything in the build system can be controlled via configure.
|
||||
if not flavor:
|
||||
raise MissingConfigureInfo('could not find VCS_CHECKOUT_TYPE '
|
||||
'in build config; check configure '
|
||||
'output and verify it could find a '
|
||||
'VCS binary')
|
||||
|
||||
if flavor == 'hg':
|
||||
return HgRepository(buildconfig.topsrcdir,
|
||||
hg=buildconfig.substs['HG'])
|
||||
elif flavor == 'git':
|
||||
return GitRepository(buildconfig.topsrcdir,
|
||||
git=buildconfig.subst['GIT'])
|
||||
else:
|
||||
raise MissingVCSInfo('unknown VCS_CHECKOUT_TYPE value: %s' % flavor)
|
||||
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
"""Obtain a repository object by looking at the environment."""
|
||||
def ancestors(path):
|
||||
while path:
|
||||
yield path
|
||||
|
@ -205,5 +163,5 @@ def get_repository_from_env():
|
|||
except InvalidRepoPath:
|
||||
continue
|
||||
|
||||
raise MissingVCSInfo('Could not find Mercurial or Git checkout for %s' %
|
||||
os.getcwd())
|
||||
raise Exception('Could not find Mercurial or Git checkout for %s' %
|
||||
os.getcwd())
|
||||
|
|
|
@ -21,11 +21,6 @@ tar -xjvf $UPLOAD_DIR/mozjs-*.tar.bz2
|
|||
|
||||
# Build the freshly extracted, packaged SpiderMonkey.
|
||||
pushd ./mozjs-*/js/src
|
||||
|
||||
# MOZ_AUTOMATION enforces certain requirements that don't apply to
|
||||
# packaged builds. Unset it.
|
||||
unset MOZ_AUTOMATION
|
||||
|
||||
AUTOMATION=1 $PYTHON ./devtools/automation/autospider.py --skip-tests=checks $SPIDERMONKEY_VARIANT
|
||||
popd
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче