Bug 1519603 - Run build/subconfigure.py in one pass. r=nalexander
authorMike Hommey <mh+mozilla@glandium.org>
Mon, 14 Jan 2019 18:39:12 +0000
changeset 513855 8688b128061b
parent 513854 129e9f6b6295
child 513856 94f3932b2f95
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [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 - Run build/subconfigure.py in one pass. r=nalexander It was useful to run the prepare phase and the actual subconfigure separately, but it's not anymore after all the recent simplications. Depends on D16381 Differential Revision: https://phabricator.services.mozilla.com/D16382
build/subconfigure.py
old-configure.in
--- a/build/subconfigure.py
+++ b/build/subconfigure.py
@@ -163,16 +163,17 @@ def prepare(srcdir, objdir, shell, 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))
     else:
         data['cache-file'] = mozpath.join(objdir, 'config.cache')
@@ -184,16 +185,18 @@ def prepare(srcdir, objdir, shell, args)
         os.makedirs(objdir)
     except OSError as e:
         if e.errno != errno.EEXIST:
             raise
 
     with open(data_file, 'wb') as f:
         pickle.dump(data, f)
 
+    return data
+
 
 def prefix_lines(text, prefix):
     return ''.join('%s> %s' % (prefix, line) for line in text.splitlines(True))
 
 
 def execute_and_prefix(*args, **kwargs):
     prefix = kwargs['prefix']
     del kwargs['prefix']
@@ -203,23 +206,20 @@ def execute_and_prefix(*args, **kwargs):
         line = proc.stdout.readline()
         if not line:
             break
         print(prefix_lines(line.rstrip(), prefix))
         sys.stdout.flush()
     return proc.wait()
 
 
-def run(objdir):
+def run(data):
     ret = 0
 
-    with open(os.path.join(objdir, CONFIGURE_DATA), 'rb') as f:
-        data = pickle.load(f)
-
-    data['objdir'] = objdir
+    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)
 
     # Only run configure if one of the following is true:
@@ -303,35 +303,25 @@ def run(objdir):
             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
 
 
-def subconfigure(args):
-    parser = argparse.ArgumentParser()
-    parser.add_argument('subconfigure', type=str,
-                        help='Subconfigure to run')
-    args, others = parser.parse_known_args(args)
-    return run(args.subconfigure)
-
-
 def main(args):
-    if args[0] != '--prepare':
-        return subconfigure(args)
-
-    topsrcdir = os.path.abspath(args[1])
-    subdir = args[2]
+    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)
 
-    return prepare(srcdir, objdir, args[3], args[4:])
+    data = prepare(srcdir, objdir, args[2], args[3:])
+    return run(data)
 
 
 if __name__ == '__main__':
     sys.exit(main(sys.argv[1:]))
--- a/old-configure.in
+++ b/old-configure.in
@@ -3755,19 +3755,18 @@ case "$host" in
   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
 
-eval $dumpenv $PYTHON $_topsrcdir/build/subconfigure.py --prepare "$srcdir" js/src "$_CONFIG_SHELL" $ac_configure_args --cache-file="$cache_file"
-
 trap '' EXIT
-if ! $PYTHON $_topsrcdir/build/subconfigure.py js/src; then
+eval $dumpenv $PYTHON $_topsrcdir/build/subconfigure.py "$srcdir" js/src "$_CONFIG_SHELL" $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