Bug 1403346 - Use mozbuild.shellutil.split instead of split in config.status
While we're here, provide a reference to unique_list as defined in
moz.configure when executing config.data to avoid its redefinition
in m4.
MozReview-Commit-ID: AI6XhoYR0Ye
--- a/build/autoconf/config.status.m4
+++ b/build/autoconf/config.status.m4
@@ -23,30 +23,30 @@ dnl Like AC_SUBST, but makes the value a
dnl with values got from the value of the environment variable, split on
dnl whitespaces.
define([AC_SUBST_SET],
[ifdef([AC_SUBST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_SET on the same variable ($1)])],
[ifdef([AC_SUBST_LIST$1], [m4_fatal([Cannot use AC_SUBST_LIST and AC_SUBST_SET on the same variable ($1)])],
[ifdef([AC_SUBST_SET_$1], ,
[define([AC_SUBST_SET_$1], )dnl
AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
- (''' $1 ''', unique_list(r''' [$]$1 '''.split()))
+ (''' $1 ''', unique_list(split(r''' [$]$1 ''')))
AC_DIVERT_POP()dnl
])])])])
dnl Like AC_SUBST, but makes the value available as a list in python,
dnl with values got from the value of the environment variable, split on
dnl whitespaces.
define([AC_SUBST_LIST],
[ifdef([AC_SUBST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_LIST on the same variable ($1)])],
[ifdef([AC_SUBST_SET_$1], [m4_fatal([Cannot use AC_SUBST_SET and AC_SUBST_LIST on the same variable ($1)])],
[ifdef([AC_SUBST_LIST_$1], ,
[define([AC_SUBST_LIST_$1], )dnl
AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
- (''' $1 ''', list(r''' [$]$1 '''.split()))
+ (''' $1 ''', list(split(r''' [$]$1 ''')))
AC_DIVERT_POP()dnl
])])])])
dnl Ignore AC_SUBSTs for variables we don't have use for but that autoconf
dnl itself exports.
define([AC_SUBST_CFLAGS], )
define([AC_SUBST_CPPFLAGS], )
define([AC_SUBST_CXXFLAGS], )
@@ -101,22 +101,16 @@ AC_CACHE_SAVE
trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
: ${CONFIG_STATUS=./config.data}
dnl We're going to need [ ] for python syntax.
changequote(<<<, >>>)dnl
echo creating $CONFIG_STATUS
cat > $CONFIG_STATUS <<EOF
-def unique_list(l):
- result = []
- for i in l:
- if l not in result:
- result.append(i)
- return result
dnl All defines and substs are stored with an additional space at the beginning
dnl and at the end of the string, to avoid any problem with values starting or
dnl ending with quotes.
defines = [
EOF
dnl confdefs.pytmp contains AC_DEFINEs, in the expected format, but
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -301,16 +301,17 @@ def old_configure_options(*options):
)
@imports(_from='__builtin__', _import='compile')
@imports(_from='__builtin__', _import='open')
@imports('logging')
@imports('os')
@imports('subprocess')
@imports('sys')
@imports(_from='mozbuild.shellutil', _import='quote')
+@imports(_from='mozbuild.shellutil', _import='split')
def old_configure(prepare_configure, extra_old_configure_args, all_options,
*options):
cmd = prepare_configure
# old-configure only supports the options listed in @old_configure_options
# so we don't need to pass it every single option we've been passed. Only
# the ones that are not supported by python configure need to.
cmd += [
@@ -361,17 +362,20 @@ def old_configure(prepare_configure, ext
with log.queue_debug():
with encoded_open('config.log', 'r') as fh:
fh.seek(log_size)
for line in fh:
log.debug(line.rstrip())
log.error('old-configure failed')
sys.exit(ret)
- raw_config = {}
+ raw_config = {
+ 'split': split,
+ 'unique_list': unique_list,
+ }
with encoded_open('config.data', 'r') as fh:
code = compile(fh.read(), 'config.data', 'exec')
# Every variation of the exec() function I tried led to:
# SyntaxError: unqualified exec is not allowed in function 'main' it
# contains a nested function with free variables
exec code in raw_config # noqa
# Ensure all the flags known to old-configure appear in the