[llvm-commits] [zorg] r149399 - /zorg/trunk/zorg/buildbot/builders/LLDBBuilder.py

Galina Kistanova gkistanova at gmail.com
Tue Jan 31 10:55:36 PST 2012


Author: gkistanova
Date: Tue Jan 31 12:55:35 2012
New Revision: 149399

URL: http://llvm.org/viewvc/llvm-project?rev=149399&view=rev
Log:
lldb builder changes; Patch for Mark Peek

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

Modified: zorg/trunk/zorg/buildbot/builders/LLDBBuilder.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/LLDBBuilder.py?rev=149399&r1=149398&r2=149399&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/LLDBBuilder.py (original)
+++ zorg/trunk/zorg/buildbot/builders/LLDBBuilder.py Tue Jan 31 12:55:35 2012
@@ -3,91 +3,120 @@
 import buildbot
 import buildbot.process.factory
 from buildbot.steps.source import SVN
-from buildbot.steps.shell import SetProperty, ShellCommand, WarningCountingShellCommand
+from buildbot.steps.shell import Configure, SetProperty
+from buildbot.steps.shell import ShellCommand, WarningCountingShellCommand
 from buildbot.process.properties import WithProperties
 
-import ClangBuilder
-
-def isNewLLVMRevision(build_status):
-    if build_status.getNumber() == 0:
-        return true
-
-    current_llvmrev = build_status.getProperty('llvmrev')
-    try:
-        prev_build_no = build_status.getNumber()-1
-        prev_build_status = build_status.getBuilder().getBuild(prev_build_no)
-        prev_llvmrev = prev_build_status.getProperty('llvmrev')
-        return prev_llvmrev != current_llvmrev
-    except IndexError:
-        return true
-
-def getLLDBBuildFactory(triple, outOfDir=False, useTwoStage=False,
+def getLLDBBuildFactory(triple, outOfDir=False, useTwoStage=False, jobs=1,
                         always_install=False, extra_configure_args=[],
                         env={}, *args, **kwargs):
-    # FIXME: this code is copied from getClangBuildFactory
+
     inDir = not outOfDir and not useTwoStage
     if inDir:
         llvm_srcdir = "llvm"
-        llvm_1_objdir = "llvm"
-        if always_install:
-            llvm_1_installdir = "llvm.install"
-        else:
-            llvm_1_installdir = None
+        llvm_objdir = "llvm"
     else:
         llvm_srcdir = "llvm.src"
-        llvm_1_objdir = "llvm.obj"
-        llvm_1_installdir = "llvm.install.1"
-        llvm_2_objdir = "llvm.obj.2"
-        llvm_2_installdir = "llvm.install"
+        llvm_objdir = "llvm.obj"
 
     f = buildbot.process.factory.BuildFactory()
 
+    # Determine the build directory.
+    f.addStep(buildbot.steps.shell.SetProperty(name="get_builddir",
+                                               command=["pwd"],
+                                               property="builddir",
+                                               description="set build dir",
+                                               workdir="."))
+
+    # We really want to revert the patched llvm/clang files but svn sometimes
+    # doesn't do the right thing. We're left with removing and rebuilding.
+    f.addStep(ShellCommand(name='rm-%s' % llvm_srcdir,
+                           command=['rm', '-rf', llvm_srcdir],
+                           haltOnFailure = True,
+                           workdir='.', env=env))
+    # Find out what version of llvm and clang are needed to build this version
+    # of lldb. Right now we will assume they use the same version.
+    # XXX - could this be done directly on the master instead of the slave?
+    f.addStep(SetProperty(command='svn cat http://llvm.org/svn/llvm-project/lldb/trunk/scripts/build-llvm.pl | grep ^our.*llvm_revision | cut -d \\" -f 2',
+                          property='llvmrev'))
+
+    # The SVN build step provides no mechanism to check out a specific revision
+    # based on a property, so just run the commands directly here.
+
+    svn_co = ['svn', 'checkout', '--force']
+    svn_co += ['--revision', WithProperties('%(llvmrev)s')]
+
+    # build llvm svn checkout command
+    svn_co_llvm = svn_co + \
+     [WithProperties('http://llvm.org/svn/llvm-project/llvm/trunk@%(llvmrev)s'),
+                     llvm_srcdir]
+    # build clang svn checkout command
+    svn_co_clang = svn_co + \
+     [WithProperties('http://llvm.org/svn/llvm-project/cfe/trunk@%(llvmrev)s'),
+                     '%s/tools/clang' % llvm_srcdir]
+
+    f.addStep(ShellCommand(name='svn-llvm',
+                           command=svn_co_llvm,
+                           haltOnFailure=True,
+                           workdir='.'))
+    f.addStep(ShellCommand(name='svn-clang',
+                           command=svn_co_clang,
+                           haltOnFailure=True,
+                           workdir='.'))
+
     f.addStep(SVN(name='svn-lldb',
                   mode='update',
                   baseURL='http://llvm.org/svn/llvm-project/lldb/',
                   defaultBranch='trunk',
+                  always_purge=True,
                   workdir='%s/tools/lldb' % llvm_srcdir))
-    f.addStep(SetProperty(command='grep ^our.*llvm_revision scripts/build-llvm.pl | cut -d \\" -f 2',
-                          property='llvmrev',
-                          workdir='%s/tools/lldb' % llvm_srcdir))
-
-    same_llvmrev = lambda step: not isNewLLVMRevision(step.build.getStatus())
-    new_llvmrev = lambda step: isNewLLVMRevision(step.build.getStatus())
-
-    # Clean LLVM only if its revision number changed since the last build.
-    # Otherwise, only clean LLDB.
-    clean_lldb = \
-        WarningCountingShellCommand(name="clean-lldb",
-                                    command=['make', "clean"],
-                                    haltOnFailure=True,
-                                    description="cleaning lldb",
-                                    descriptionDone="clean lldb",
-                                    workdir='%s/tools/lldb' % llvm_1_objdir,
-                                    doStepIf=same_llvmrev)
-
-    # We use force_checkout to ensure the initial checkout is not aborted due to
-    # the presence of the tools/lldb directory
-    clangf = ClangBuilder.getClangBuildFactory(triple, test=False,
-                                               outOfDir=outOfDir,
-                                               useTwoStage=useTwoStage,
-                                               always_install=always_install,
-                                               extra_configure_args=
-                                                 extra_configure_args+
-                                                 ['--enable-targets=host'],
-                                               env=env,
-                                               trunk_revision='%(llvmrev)s',
-                                               force_checkout=True,
-                                               clean=new_llvmrev,
-                                               extra_clean_step=clean_lldb,
-                                               *args, **kwargs)
-    f.steps += clangf.steps
+
+    # Patch llvm with lldb changes
+    f.addStep(ShellCommand(name='patch.llvm',
+        command='for i in tools/lldb/scripts/llvm*.diff; do echo "Patching with file $i"; patch -p0 -i $i; done',
+        workdir=llvm_srcdir))
+
+    # Patch clang with lldb changes
+    f.addStep(ShellCommand(name='patch.clang',
+        command='for i in ../lldb/scripts/clang*.diff; do echo "Patching with file $i"; patch -p0 -i $i; done',
+        workdir='%s/tools/clang' % llvm_srcdir))
+
+    # Run configure
+    config_args = [WithProperties("%%(builddir)s/%s/configure" % llvm_srcdir),
+                   "--disable-bindings",
+                   "--without-llvmgcc",
+                   "--without-llvmgxx",
+                  ]
+    if triple:
+        config_args += ['--build=%s' % triple]
+    config_args += extra_configure_args
+
+    f.addStep(Configure(name='configure',
+        command=config_args,
+        workdir=llvm_objdir))
+
+    f.addStep(WarningCountingShellCommand(name="compile",
+                                          command=['nice', '-n', '10',
+                                          'make', WithProperties("-j%s" % jobs)
+                                          ],
+                                          haltOnFailure=True,
+                                          workdir=llvm_objdir))
+
+    # The tests are hanging on Linux at the moment due to some "expect"
+    # functionality not happening correctly. For now we will stub out the tests
+    # so we can at least get builds running and reinstate the tests later.
+
+    # Fixup file needed for tests
+    # f.addStep(ShellCommand(name"copy-gnu_libstdcpp.py",
+    #                       command="cp tools/lldb/examples/synthetic/gnu_libstdcpp.py Debug+Asserts/bin",
+    #                       workdir=llvm_srcdir))
 
     # Test.
-    f.addStep(ShellCommand(name="test",
-                           command=['nice', '-n', '10',
-                                    'make'],
-                           haltOnFailure=True, description="test lldb",
-                           env=env,
-                           workdir='%s/tools/lldb/test' % llvm_1_objdir))
+    #f.addStep(ShellCommand(name="test",
+    #                       command=['nice', '-n', '10',
+    #                                'make'],
+    #                       haltOnFailure=True, description="test lldb",
+    #                       env=env,
+    #                       workdir='%s/tools/lldb/test' % llvm_objdir))
 
     return f





More information about the llvm-commits mailing list