[zorg] r195390 - Attempt to fix an issue - nulls are passed to ninja.

Galina Kistanova gkistanova at gmail.com
Thu Nov 21 15:43:41 PST 2013


Author: gkistanova
Date: Thu Nov 21 17:43:41 2013
New Revision: 195390

URL: http://llvm.org/viewvc/llvm-project?rev=195390&view=rev
Log:
Attempt to fix an issue - nulls are passed to ninja.

Added:
    zorg/trunk/zorg/buildbot/commands/NinjaCommand.py
Modified:
    zorg/trunk/zorg/buildbot/builders/ClangAndLLDBuilder.py
    zorg/trunk/zorg/buildbot/commands/__init__.py

Modified: zorg/trunk/zorg/buildbot/builders/ClangAndLLDBuilder.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/ClangAndLLDBuilder.py?rev=195390&r1=195389&r2=195390&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/ClangAndLLDBuilder.py (original)
+++ zorg/trunk/zorg/buildbot/builders/ClangAndLLDBuilder.py Thu Nov 21 17:43:41 2013
@@ -7,6 +7,7 @@ from buildbot.steps.shell import ShellCo
 from buildbot.steps.shell import WarningCountingShellCommand
 from buildbot.process.properties import WithProperties
 from zorg.buildbot.commands.LitTestCommand import LitTestCommand
+from zorg.buildbot.commands.NinjaCommand import NinjaCommand
 
 def getClangAndLLDBuildFactory(
            clean=True,
@@ -106,26 +107,21 @@ def getClangAndLLDBuildFactory(
                                workdir=llvm_objdir,
                                env=merged_env))
 
-    ninjaCommand = [
-        "nice", "-n", "10",
-        "ninja",
-             WithProperties("%(jobs:+-j)s"),        WithProperties("%(jobs:-)s"),
-             WithProperties("%(loadaverage:+-l)s"), WithProperties("%(loadaverage:-)s")]
-
     # Build everything.
-    f.addStep(WarningCountingShellCommand(name="build",
-                                          command=ninjaCommand,
-                                          haltOnFailure=True,
-                                          description=["build"],
-                                          workdir=llvm_objdir,
-                                          env=merged_env))
+    f.addStep(NinjaCommand(name="build",
+                           prefixCommand=["nice", "-n", "10"],
+                           haltOnFailure=True,
+                           description=["build"],
+                           workdir=llvm_objdir,
+                           env=merged_env))
 
     # Test everything.
-    f.addStep(LitTestCommand(name="test",
-                             command=ninjaCommand + ["check-all"],
-                             haltOnFailure=True,
-                             description=["test"],
-                             workdir=llvm_objdir,
-                             env=merged_env))
+    f.addStep(NinjaCommand(name="test",
+                           prefixCommand=["nice", "-n", "10"],
+                           targets=["check-all"],
+                           haltOnFailure=True,
+                           description=["test"],
+                           workdir=llvm_objdir,
+                           env=merged_env))
 
     return f

Added: zorg/trunk/zorg/buildbot/commands/NinjaCommand.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/commands/NinjaCommand.py?rev=195390&view=auto
==============================================================================
--- zorg/trunk/zorg/buildbot/commands/NinjaCommand.py (added)
+++ zorg/trunk/zorg/buildbot/commands/NinjaCommand.py Thu Nov 21 17:43:41 2013
@@ -0,0 +1,38 @@
+from buildbot.process.properties import WithProperties
+from buildbot.steps.shell import WarningCountingShellCommand
+
+from twisted.python import log
+
+class NinjaCommand(WarningCountingShellCommand):
+
+    def __init__(self, prefixCommand=None, targets=None, **kwargs):
+        self.prefixCommand = prefixCommand
+        self.targets = targets
+
+        command = []
+        if prefixCommand:
+            command += prefixCommand
+
+        command += ["ninja",
+                     WithProperties("%(jobs:+-j)s"),        WithProperties("%(jobs:-)s"),
+                     WithProperties("%(loadaverage:+-l)s"), WithProperties("%(loadaverage:-)s")]
+
+        if targets:
+            command += targets
+
+        # Don't forget to remove all the empty items from the command,
+        # which we could get because of WithProperties rendered as empty strings.
+        kwargs['command'] = command
+
+        # And upcall to let the base class do its work
+        WarningCountingShellCommand.__init__(self, **kwargs)
+
+        self.addFactoryArguments(prefixCommand=prefixCommand,
+                                 targets=targets)
+
+    def start(self):
+        # Don't forget to remove all the empty items from the command,
+        # which we could get because of WithProperties rendered as empty strings.
+        self.command = filter(bool, self.command)
+        # Then upcall.
+        WarningCountingShellCommand.start(self)

Modified: zorg/trunk/zorg/buildbot/commands/__init__.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/commands/__init__.py?rev=195390&r1=195389&r2=195390&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/commands/__init__.py (original)
+++ zorg/trunk/zorg/buildbot/commands/__init__.py Thu Nov 21 17:43:41 2013
@@ -4,5 +4,6 @@ import LitTestCommand
 import SuppressionDejaGNUCommand
 import DejaGNUCommand
 import GTestCommand
+import NinjaCommand
 
 __all__ = []





More information about the llvm-commits mailing list