[zorg] r188780 - [llvmlab] Make the LibCXX builder even more generic by including the ability to provide an external buildfactory, sources, and lit path.

Michael Gottesman mgottesman at apple.com
Tue Aug 20 02:38:56 PDT 2013


Author: mgottesman
Date: Tue Aug 20 04:38:56 2013
New Revision: 188780

URL: http://llvm.org/viewvc/llvm-project?rev=188780&view=rev
Log:
[llvmlab] Make the LibCXX builder even more generic by including the ability to provide an external buildfactory, sources, and lit path.

Modified:
    zorg/trunk/zorg/buildbot/builders/LibCXXBuilder.py

Modified: zorg/trunk/zorg/buildbot/builders/LibCXXBuilder.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/LibCXXBuilder.py?rev=188780&r1=188779&r2=188780&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/LibCXXBuilder.py (original)
+++ zorg/trunk/zorg/buildbot/builders/LibCXXBuilder.py Tue Aug 20 04:38:56 2013
@@ -1,4 +1,6 @@
 
+import os
+
 import buildbot
 import buildbot.process.factory
 import buildbot.steps.shell
@@ -14,19 +16,25 @@ reload(lit_test_command)
 reload(artifacts)
 reload(phased_builder_utils)
 
-def getLibCXXBuilder():
-    f = buildbot.process.factory.BuildFactory()
+def getLibCXXBuilder(f=None, source_path=None,
+                     lit_path=None):
+    if f is None:
+        f = buildbot.process.factory.BuildFactory()
+        # Find the build directory. We assume if f is passed in that the build
+        # directory has already been found.
+        f = phased_builder_utils.getBuildDir(f)
     
-    # Grab the sources.
-    src_url = 'http://llvm.org/svn/llvm-project/libcxx/trunk'
-    f = phased_builder_utils.SVNCleanupStep(f, 'sources')
-    f.addStep(svn.SVN(name='pull.src', mode='full', repourl=src_url,
-                      workdir='sources', method='fresh',
-                      alwaysUseLatest=False, retry = (60, 5),
-                      description='pull.src'))
+    # Grab the sources if we are not passed in any.
+    if source_path is None:
+        source_path = 'sources'
+        src_url = 'http://llvm.org/svn/llvm-project/libcxx/trunk'
+        f = phased_builder_utils.SVNCleanupStep(f, source_path)
+        f.addStep(svn.SVN(name='pull.src', mode='full', repourl=src_url,
+                          workdir=source_path, method='fresh',
+                          alwaysUseLatest=False, retry = (60, 5),
+                          description='pull.src'))
     
-    # Find the build directory and grab the artifacts for our build.
-    f = phased_builder_utils.getBuildDir(f)
+    # Grab the artifacts for our build.
     f = artifacts.GetCompilerArtifacts(f)
     host_compiler_dir = properties.WithProperties('%(builddir)s/host-compiler')
     f = artifacts.GetCCFromCompilerArtifacts(f, host_compiler_dir)
@@ -36,20 +44,26 @@ def getLibCXXBuilder():
     CC = properties.WithProperties('%(cc_path)s')
     CXX = properties.WithProperties('%(cxx_path)s')
     HEADER_INCLUDE = \
-        properties.WithProperties('-I %(builddir)s/sources/include')
+        properties.WithProperties('-I %s' % os.path.join('%(builddir)s',
+                                                         source_path,
+                                                         'include'))
     SOURCE_LIB = \
-        properties.WithProperties('%(builddir)s/sources/lib/libc++.1.dylib')
+        properties.WithProperties(os.path.join('%(builddir)s',
+                                               source_path, 'lib',
+                                               'libc++.1.dylib'))
     
     f.addStep(buildbot.steps.shell.ShellCommand(
               name='build.libcxx', command=['./buildit'], haltOnFailure=True, 
-              workdir='sources/lib', 
+              workdir=os.path.join(source_path, 'lib'),
               env={ 'CC' : CC, 'CXX' : CXX, 'TRIPLE' : '-apple-'}))
 
-    # Get the 'lit' sources.
-    f.addStep(svn.SVN(
+    # Get the 'lit' sources if we need to.
+    if lit_path is None:
+        lit_dir = 'lit.src'
+        f.addStep(svn.SVN(
             name='pull.lit', mode='incremental', method='fresh',
             repourl='http://llvm.org/svn/llvm-project/llvm/trunk/utils/lit',
-            workdir='lit.src', alwaysUseLatest=False))
+            workdir=lit_dir, alwaysUseLatest=False))
 
     # Install a copy of 'lit' in a virtualenv.
     f.addStep(buildbot.steps.shell.ShellCommand(
@@ -63,7 +77,7 @@ def getLibCXXBuilder():
     f.addStep(buildbot.steps.shell.ShellCommand(
             name='venv.lit.install',
             command=['../lit.venv/bin/python', 'setup.py', 'install'],
-            workdir='lit.src', haltOnFailure=True))
+            workdir=lit_dir, haltOnFailure=True))
 
     # Run the tests with the system's dylib
     f.addStep(lit_test_command.LitTestCommand(





More information about the llvm-commits mailing list