[zorg] r283845 - Re-factored to take the jobs property every time a build step gets created; added support for multiple jobs opt formats.

Galina Kistanova via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 10 18:58:18 PDT 2016


Author: gkistanova
Date: Mon Oct 10 20:58:18 2016
New Revision: 283845

URL: http://llvm.org/viewvc/llvm-project?rev=283845&view=rev
Log:
Re-factored to take the jobs property every time a build step gets created; added support for multiple jobs opt formats.

Modified:
    zorg/trunk/zorg/buildbot/commands/MakeCommand.py

Modified: zorg/trunk/zorg/buildbot/commands/MakeCommand.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/commands/MakeCommand.py?rev=283845&r1=283844&r2=283845&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/commands/MakeCommand.py (original)
+++ zorg/trunk/zorg/buildbot/commands/MakeCommand.py Mon Oct 10 20:58:18 2016
@@ -1,3 +1,5 @@
+import re
+
 from buildbot.process.properties import WithProperties
 from buildbot.steps.shell import WarningCountingShellCommand
 
@@ -25,24 +27,31 @@ class MakeCommand(WarningCountingShellCo
         self.prefixCommand = prefixCommand
         self.targets = targets
 
+        command = []
+        if prefixCommand:
+            command += prefixCommand
+
+        command += ["make"]
+
         if options is None:
             self.options = list()
         else:
             self.options = list(options)
 
-        if kwargs.get('jobs', None):
-             self.options += ["-j", kwargs['jobs']]
-        else:
-             self.options += [
-                 WithProperties("%(jobs:+-j)s"),
-                 WithProperties("%(jobs:-)s"),
-                 ]
-
-        command = []
-        if prefixCommand:
-            command += prefixCommand
+        j_opt = re.compile(r'^-j$|^-j\d+$')
 
-        command += ["make"]
+        # We can get jobs in the options. If so, we would use that.
+        if not any(j_opt.search(opt) for opt in self.options if isinstance(opt, basestring)):
+            # Otherwise let's see if we got it in the kwargs.
+            if kwargs.get('jobs', None):
+                self.options += ["-j", kwargs['jobs']]
+            else:
+                # Use the property if option was not explicitly
+                # specified.
+                command += [
+                    WithProperties("%(jobs:+-j)s"),
+                    WithProperties("%(jobs:-)s"),
+                    ]
 
         if self.options:
             command += self.options




More information about the llvm-commits mailing list