Bug 1322025 - Provide variants of host and target that depend on --help. r=chmanchester

We want to avoid giving --help dependencies to host and target, so that
they we don't spawn config.guess and config.sub when running configure
--help, and don't need to reach out to the which module to find a
suitable shell to execute them.

So, when --help is given, we return a fake host/target namespace, and
avoid the config.guess/config.sub-invoking code being executed.

Then, by giving the --help option to the linter, it can properly find
that the config.guess/config.sub-invoking code doesn't need the
dependency on --help.

This effectively unbreaks configure --help after bug 1313306.

--HG--
extra : rebase_source : 9ed4cbe5a81121b139d0d86aff6af542c2dff53b
This commit is contained in:
Mike Hommey 2017-01-25 17:54:16 +09:00
Родитель c480e73bf9
Коммит 9982192790
3 изменённых файлов: 24 добавлений и 3 удалений

Просмотреть файл

@ -417,6 +417,23 @@ def split_triplet(triplet):
)
# This defines a fake target/host namespace for when running with --help
@depends('--help')
def help_host_target(help):
if help:
return namespace(
alias='unknown-unknown-unknown',
cpu='unknown',
bitness='unknown',
kernel='unknown',
os='unknown',
endianness='unknown',
raw_cpu='unknown',
raw_os='unknown',
toolchain='unknown-unknown',
)
@imports('subprocess')
def config_sub(shell, triplet):
config_sub = os.path.join(os.path.dirname(__file__), '..',
@ -437,6 +454,8 @@ def host(value, shell):
return split_triplet(config_sub(shell, host))
host = help_host_target | host
@depends('--target', host, shell)
@checking('for target system type', lambda t: t.alias)
@ -445,6 +464,8 @@ def target(value, host, shell):
return host
return split_triplet(config_sub(shell, value[0]))
target = help_host_target | target
@depends(host, target)
@checking('whether cross compiling')

Просмотреть файл

@ -148,8 +148,8 @@ class CombinedDependsFunction(DependsFunction):
@memoize
def result(self, need_help_dependency=False):
resolved_args = [self.sandbox._value_for(d, need_help_dependency)
for d in self.dependencies]
resolved_args = (self.sandbox._value_for(d, need_help_dependency)
for d in self.dependencies)
return self._func(resolved_args)
def __eq__(self, other):

Просмотреть файл

@ -57,7 +57,7 @@ class Lint(unittest.TestCase):
'OLD_CONFIGURE': os.path.join(topsrcdir, 'old-configure'),
'MOZCONFIG': os.path.join(os.path.dirname(test_path), 'data',
'empty_mozconfig'),
}, ['--enable-project=%s' % project])
}, ['--enable-project=%s' % project, '--help'])
sandbox.run(os.path.join(topsrcdir, 'moz.configure'))