Bug 1519603 - Hardcode js/src into subconfigure.py. r=nalexander
authorMike Hommey <mh+mozilla@glandium.org>
Mon, 14 Jan 2019 18:40:41 +0000
changeset 510974 94f3932b2f958e6c414e3778db4ffb39af42ca8e
parent 510973 8688b128061b7d7ffe967ee7d0050795d058e932
child 510975 2809c756574d28c25d031eecd41779d3392c44d4
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1519603
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1519603 - Hardcode js/src into subconfigure.py. r=nalexander Because subconfigure.py is only used for js/src and we're not going to add any more subconfigures, we can hardcode js/src into the script, and remove the branches that aren't taken as a consequence. Depends on D16382 Differential Revision: https://phabricator.services.mozilla.com/D16402
build/subconfigure.py
old-configure.in
--- a/build/subconfigure.py
+++ b/build/subconfigure.py
@@ -115,17 +115,17 @@ def maybe_clear_cache(data):
             print('  %s' % (value if value is not None else 'undefined'))
             print('to:')
             print('  %s' % env.get(precious, 'undefined'))
             os.remove(data['cache-file'])
             return True
     return False
 
 
-def prepare(srcdir, objdir, shell, args):
+def prepare(srcdir, objdir, args):
     parser = argparse.ArgumentParser()
     parser.add_argument('--target', type=str)
     parser.add_argument('--host', type=str)
     parser.add_argument('--build', type=str)
     parser.add_argument('--cache-file', type=str)
     # The --srcdir argument is simply ignored. It's a useless autoconf feature
     # that we don't support well anyways. This makes it stripped from `others`
     # and allows to skip setting it when calling the subconfigure (configure
@@ -161,17 +161,16 @@ def prepare(srcdir, objdir, shell, args)
 
     args, others = parser.parse_known_args(args)
 
     data = {
         'target': args.target,
         'host': args.host,
         'build': args.build,
         'args': others,
-        'shell': shell,
         'srcdir': srcdir,
         'objdir': objdir,
         'env': environ,
     }
 
     if args.cache_file:
         data['cache-file'] = mozpath.normpath(mozpath.join(os.getcwd(),
                                                            args.cache_file))
@@ -207,18 +206,16 @@ def execute_and_prefix(*args, **kwargs):
         if not line:
             break
         print(prefix_lines(line.rstrip(), prefix))
         sys.stdout.flush()
     return proc.wait()
 
 
 def run(data):
-    ret = 0
-
     objdir = data['objdir']
     relobjdir = data['relobjdir'] = os.path.relpath(objdir, os.getcwd())
 
     cache_file = data['cache-file']
     cleared_cache = True
     if os.path.exists(cache_file):
         cleared_cache = maybe_clear_cache(data)
 
@@ -243,33 +240,30 @@ def run(data):
                 dep_files = fh.read().splitlines() + [configure]
             if (any(not os.path.exists(f) or (config_status.mtime < os.path.getmtime(f))
                     for f in dep_files) or
                 data.get('previous-args', data['args']) != data['args'] or
                 cleared_cache):
                 skip_configure = False
 
     if not skip_configure:
-        if mozpath.normsep(relobjdir) == 'js/src':
-            # Because configure is a shell script calling a python script
-            # calling a shell script, on Windows, with msys screwing the
-            # environment, we lose the benefits from our own efforts in this
-            # script to get past the msys problems. So manually call the python
-            # script instead, so that we don't do a native->msys transition
-            # here. Then the python configure will still have the right
-            # environment when calling the shell configure.
-            command = [
-                sys.executable,
-                os.path.join(os.path.dirname(__file__), '..', 'configure.py'),
-                '--enable-project=js',
-            ]
-            data['env']['OLD_CONFIGURE'] = os.path.join(
-                os.path.dirname(configure), 'old-configure')
-        else:
-            command = [data['shell'], configure]
+        # Because configure is a shell script calling a python script
+        # calling a shell script, on Windows, with msys screwing the
+        # environment, we lose the benefits from our own efforts in this
+        # script to get past the msys problems. So manually call the python
+        # script instead, so that we don't do a native->msys transition
+        # here. Then the python configure will still have the right
+        # environment when calling the shell configure.
+        command = [
+            sys.executable,
+            os.path.join(os.path.dirname(__file__), '..', 'configure.py'),
+            '--enable-project=js',
+        ]
+        data['env']['OLD_CONFIGURE'] = os.path.join(
+            os.path.dirname(configure), 'old-configure')
         for kind in ('target', 'build', 'host'):
             if data.get(kind) is not None:
                 command += ['--%s=%s' % (kind, data[kind])]
         command += data['args']
         command += ['--cache-file=%s' % cache_file]
 
         # Pass --no-create to configure so that it doesn't run config.status.
         # We're going to run it ourselves.
@@ -278,50 +272,22 @@ def run(data):
         print(prefix_lines('configuring', relobjdir))
         print(prefix_lines('running %s' % ' '.join(command[:-1]), relobjdir))
         sys.stdout.flush()
         returncode = execute_and_prefix(command, cwd=objdir, env=data['env'],
                                         prefix=relobjdir)
         if returncode:
             return returncode
 
-    # Only run config.status if one of the following is true:
-    # - config.status changed or did not exist
-    # - one of the templates for config files is newer than the corresponding
-    #   config file.
-    skip_config_status = True
-    if mozpath.normsep(relobjdir) == 'js/src':
-        # Running config.status in js/src actually does nothing, so we just
-        # skip it.
-        pass
-    elif not config_status or config_status.modified:
-        # If config.status doesn't exist after configure (because it's not
-        # an autoconf configure), skip it.
-        if os.path.exists(config_status_path):
-            skip_config_status = False
-
-    if not skip_config_status:
-        if skip_configure:
-            print(prefix_lines('running config.status', relobjdir))
-            sys.stdout.flush()
-        ret = execute_and_prefix([data['shell'], '-c', './config.status'],
-                                 cwd=objdir, env=data['env'], prefix=relobjdir)
-
-    return ret
+    return 0
 
 
 def main(args):
     topsrcdir = os.path.abspath(args[0])
-    subdir = args[1]
-    # subdir can be of the form srcdir:objdir
-    if ':' in subdir:
-        srcdir, subdir = subdir.split(':', 1)
-    else:
-        srcdir = subdir
-    srcdir = os.path.join(topsrcdir, srcdir)
-    objdir = os.path.abspath(subdir)
+    srcdir = os.path.join(topsrcdir, 'js/src')
+    objdir = os.path.abspath('js/src')
 
-    data = prepare(srcdir, objdir, args[2], args[3:])
+    data = prepare(srcdir, objdir, args[1:])
     return run(data)
 
 
 if __name__ == '__main__':
     sys.exit(main(sys.argv[1:]))
--- a/old-configure.in
+++ b/old-configure.in
@@ -3737,36 +3737,31 @@ export HOST_CPPFLAGS
 export HOST_CXXFLAGS
 export HOST_LDFLAGS
 
 if ! test -e js; then
     mkdir js
 fi
 
 ac_configure_args="$ac_configure_args JS_STANDALONE="
-_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
 
 dumpenv="true | "
 case "$host" in
 *-mingw*)
-  _CONFIG_SHELL=$(cd $(dirname $_CONFIG_SHELL); pwd -W)/$(basename $_CONFIG_SHELL)
-  if test ! -e "$_CONFIG_SHELL" -a -e "${_CONFIG_SHELL}.exe"; then
-      _CONFIG_SHELL="${_CONFIG_SHELL}.exe"
-  fi
   dnl Yes, this is horrible. But since msys doesn't preserve environment
   dnl variables and command line arguments as they are when transitioning
   dnl from msys (this script) to python (below), we have to resort to hacks,
   dnl storing the environment and command line arguments from a msys process
   dnl (perl), and reading it from python.
   dumpenv="$PERL $_topsrcdir/build/win32/dumpenv4python.pl $ac_configure_args | "
   ;;
 esac
 
 trap '' EXIT
-eval $dumpenv $PYTHON $_topsrcdir/build/subconfigure.py "$srcdir" js/src "$_CONFIG_SHELL" $ac_configure_args --cache-file="$cache_file"
+eval $dumpenv $PYTHON $_topsrcdir/build/subconfigure.py "$srcdir" $ac_configure_args --cache-file="$cache_file"
 if test $? -ne 0; then
   exit 1
 fi
 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
 
 fi # COMPILE_ENVIRONMENT
 
 rm -fr confdefs* $ac_clean_files