Backed out changeset b59977d42a4d (bug 1521772) requested by Andi. a=backout
authorDaniel Varga <dvarga@mozilla.com>
Wed, 27 Feb 2019 18:27:08 +0200
changeset 461434 121bbaec1b30e7e0a4cf1b9db1db2bd8898306e6
parent 461390 f66a48e8030eab1dbf51956da9e968817d6d7184
child 461435 198cd4a81bf2afa7cc79360f90da7bc91218b76d
push id35624
push userdvarga@mozilla.com
push dateWed, 27 Feb 2019 16:31:04 +0000
treeherdermozilla-central@198cd4a81bf2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1521772
milestone67.0a1
backs outb59977d42a4ddedaee1f431b2c1725c2d64ca723
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
Backed out changeset b59977d42a4d (bug 1521772) requested by Andi. a=backout
python/mozbuild/mozbuild/mach_commands.py
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -69,26 +69,16 @@ If you feel this message is not appropri
 please file a Firefox Build System :: General bug at
 https://bugzilla.mozilla.org/enter_bug.cgi?product=Firefox%20Build%20System&component=General
 and tell us about your machine and build configuration so we can adjust the
 warning heuristic.
 ===================
 '''
 
 
-# Function used by clang-format to run it in parallel, according to the given
-# arguments. Must be defined at the top-level so it can be used with
-# multiprocessing.Pool.imap_unordered.
-def run_one_clang_format_batch(args):
-    try:
-        subprocess.check_output(args)
-    except subprocess.CalledProcessError as e:
-        return e
-
-
 class StoreDebugParamsAndWarnAction(argparse.Action):
     def __call__(self, parser, namespace, values, option_string=None):
         sys.stderr.write('The --debugparams argument is deprecated. Please ' +
                          'use --debugger-args instead.\n\n')
         setattr(namespace, self.dest, values)
 
 
 @CommandProvider
@@ -2907,74 +2897,56 @@ class StaticAnalysis(MachCommandBase):
 
         path_list = self._generate_path_list(paths)
 
         if path_list == []:
             return
 
         print("Processing %d file(s)..." % len(path_list))
 
+        batchsize = 200
         if show:
-            for i in range(0, len(path_list)):
-                l = path_list[i: (i + 1)]
-
+            batchsize = 1
+
+        for i in range(0, len(path_list), batchsize):
+            l = path_list[i: (i + batchsize)]
+            if show:
                 # Copy the files into a temp directory
                 # and run clang-format on the temp directory
                 # and show the diff
                 original_path = l[0]
                 local_path = ntpath.basename(original_path)
                 target_file = os.path.join(tmpdir, local_path)
                 faketmpdir = os.path.dirname(target_file)
                 if not os.path.isdir(faketmpdir):
                     os.makedirs(faketmpdir)
                 shutil.copy(l[0], faketmpdir)
                 l[0] = target_file
 
-                # Run clang-format on the list
-                try:
-                    check_output(args + l)
-                except CalledProcessError as e:
-                    # Something wrong happend
-                    print("clang-format: An error occured while running clang-format.")
-                    return e.returncode
-
+            # Run clang-format on the list
+            try:
+                check_output(args + l)
+            except CalledProcessError as e:
+                # Something wrong happend
+                print("clang-format: An error occured while running clang-format.")
+                return e.returncode
+
+            if show:
                 # show the diff
                 diff_command = ["diff", "-u", original_path, target_file]
                 try:
                     output = check_output(diff_command)
                 except CalledProcessError as e:
                     # diff -u returns 0 when no change
                     # here, we expect changes. if we are here, this means that
                     # there is a diff to show
                     if e.output:
                         print(e.output)
-
+        if show:
             shutil.rmtree(tmpdir)
-            return 0
-
-        import multiprocessing
-        import math
-
-        cpu_count = multiprocessing.cpu_count()
-        batchsize = int(math.ceil(float(len(path_list)) / cpu_count))
-
-        batches = []
-        for i in range(0, len(path_list), batchsize):
-            batches.append(args + path_list[i: (i + batchsize)])
-
-        pool = multiprocessing.Pool(cpu_count)
-
-        error_code = None
-        for result in pool.imap_unordered(run_one_clang_format_batch, batches):
-            if error_code is None and result is not None:
-                print("clang-format: An error occured while running clang-format.")
-                error_code = result.returncode
-
-        if error_code is not None:
-            return error_code
         return 0
 
 @CommandProvider
 class Vendor(MachCommandBase):
     """Vendor third-party dependencies into the source repository."""
 
     @Command('vendor', category='misc',
              description='Vendor third-party dependencies into the source repository.')