зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1528194 - Run config.sub when split_target fails when not running it. r=mshal
In bug 1522354, we changed host and target detection to not invoke config.sub, assuming the output from config.guess would satisfy our needs in split_target. It turns out that on some plaforms, that doesn't work out, so, while we still skip config.sub, we now catch errors from split_target when doing so, and try again after running config.sub when split_target fails. Differential Revision: https://phabricator.services.mozilla.com/D19937
This commit is contained in:
Родитель
8a74f32d09
Коммит
b2f1a3fc7f
|
@ -643,7 +643,7 @@ def split_triplet(triplet, allow_unknown=False):
|
|||
elif len(parts) == 2:
|
||||
cpu, os = parts
|
||||
else:
|
||||
die("Unexpected triplet string: %s" % triplet)
|
||||
raise ValueError("Unexpected triplet string: %s" % triplet)
|
||||
|
||||
# Autoconf uses config.sub to validate and canonicalize those triplets,
|
||||
# but the granularity of its results has never been satisfying to our
|
||||
|
@ -687,7 +687,7 @@ def split_triplet(triplet, allow_unknown=False):
|
|||
elif allow_unknown:
|
||||
canonical_os = canonical_kernel = os
|
||||
else:
|
||||
die('Unknown OS: %s' % os)
|
||||
raise ValueError('Unknown OS: %s' % os)
|
||||
|
||||
# The CPU granularity is probably not enough. Moving more things from
|
||||
# old-configure will tell us if we need more
|
||||
|
@ -737,7 +737,7 @@ def split_triplet(triplet, allow_unknown=False):
|
|||
canonical_cpu = cpu
|
||||
endianness = 'unknown'
|
||||
else:
|
||||
die('Unknown CPU type: %s' % cpu)
|
||||
raise ValueError('Unknown CPU type: %s' % cpu)
|
||||
|
||||
def sanitize(cls, value):
|
||||
try:
|
||||
|
@ -796,6 +796,7 @@ def config_sub(shell, triplet):
|
|||
@imports('os')
|
||||
@imports('subprocess')
|
||||
@imports('sys')
|
||||
@imports(_from='__builtin__', _import='ValueError')
|
||||
def real_host(value, shell):
|
||||
if not value and sys.platform == 'win32':
|
||||
arch = (os.environ.get('PROCESSOR_ARCHITEW6432') or
|
||||
|
@ -809,10 +810,19 @@ def real_host(value, shell):
|
|||
config_guess = os.path.join(os.path.dirname(__file__), '..',
|
||||
'autoconf', 'config.guess')
|
||||
host = subprocess.check_output([shell, config_guess]).strip()
|
||||
try:
|
||||
return split_triplet(host)
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
host = config_sub(shell, value[0])
|
||||
host = value[0]
|
||||
|
||||
return split_triplet(host)
|
||||
host = config_sub(shell, host)
|
||||
|
||||
try:
|
||||
return split_triplet(host)
|
||||
except ValueError as e:
|
||||
die(e.message)
|
||||
|
||||
|
||||
host = help_host_target | real_host
|
||||
|
@ -820,6 +830,7 @@ host = help_host_target | real_host
|
|||
|
||||
@depends('--target', real_host, shell, '--enable-project', '--enable-application')
|
||||
@checking('for target system type', lambda t: t.alias)
|
||||
@imports(_from='__builtin__', _import='ValueError')
|
||||
def real_target(value, host, shell, project, application):
|
||||
# Because --enable-project is implied by --enable-application, and
|
||||
# implied options are not currently handled during --help, which is
|
||||
|
@ -846,9 +857,16 @@ def real_target(value, host, shell, project, application):
|
|||
rest += 'eabi'
|
||||
else:
|
||||
cpu, rest = host.alias.split('-', 1)
|
||||
return split_triplet('-'.join((target, rest)))
|
||||
target = '-'.join((target, rest))
|
||||
try:
|
||||
return split_triplet(target)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
return split_triplet(config_sub(shell, target))
|
||||
try:
|
||||
return split_triplet(config_sub(shell, target))
|
||||
except ValueError as e:
|
||||
die(e.message)
|
||||
|
||||
|
||||
target = help_host_target | real_target
|
||||
|
|
|
@ -20,6 +20,8 @@ class TargetTest(BaseConfigureTest):
|
|||
platform = 'linux2'
|
||||
elif 'mingw' in self.HOST:
|
||||
platform = 'win32'
|
||||
elif 'openbsd6' in self.HOST:
|
||||
platform = 'openbsd6'
|
||||
else:
|
||||
raise Exception('Missing platform for HOST {}'.format(self.HOST))
|
||||
wrapped_sys = {}
|
||||
|
@ -122,6 +124,20 @@ class TestTargetAndroid(TargetTest):
|
|||
'arm-unknown-linux-androideabi')
|
||||
|
||||
|
||||
class TestTargetOpenBSD(TargetTest):
|
||||
# config.guess returns amd64 on OpenBSD, which we need to pass through to
|
||||
# config.sub so that it canonicalizes to x86_64.
|
||||
HOST = 'amd64-unknown-openbsd6.4'
|
||||
|
||||
def test_target(self):
|
||||
self.assertEqual(self.get_target([]), 'x86_64-unknown-openbsd6.4')
|
||||
|
||||
def config_sub(self, stdin, args):
|
||||
if args[0] == 'amd64-unknown-openbsd6.4':
|
||||
return 0, 'x86_64-unknown-openbsd6.4', ''
|
||||
return super(TestTargetOpenBSD, self).config_sub(stdin, args)
|
||||
|
||||
|
||||
class TestMozConfigure(BaseConfigureTest):
|
||||
def test_nsis_version(self):
|
||||
this = self
|
||||
|
|
Загрузка…
Ссылка в новой задаче