[llvm-commits] [zorg] r103396 - in /zorg/trunk: buildbot/osuosl/master/config/builders.py zorg/buildbot/builders/ScriptedBuilder.py

Duncan Sands baldrick at free.fr
Mon May 10 00:19:59 PDT 2010


Author: baldrick
Date: Mon May 10 02:19:59 2010
New Revision: 103396

URL: http://llvm.org/viewvc/llvm-project?rev=103396&view=rev
Log:
Patch by Galina Kistanova, adding a new buildbot builder ScriptedBuilder
to work with the new llvm-gcc build scripts, and updates configuration of
the llvm-gcc-x86_64-darwin10-cross-mingw32 buildslave to use ScriptedBuilder.

Added:
    zorg/trunk/zorg/buildbot/builders/ScriptedBuilder.py
Modified:
    zorg/trunk/buildbot/osuosl/master/config/builders.py

Modified: zorg/trunk/buildbot/osuosl/master/config/builders.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/osuosl/master/config/builders.py?rev=103396&r1=103395&r2=103396&view=diff
==============================================================================
--- zorg/trunk/buildbot/osuosl/master/config/builders.py (original)
+++ zorg/trunk/buildbot/osuosl/master/config/builders.py Mon May 10 02:19:59 2010
@@ -18,6 +18,12 @@
 reload(NightlytestBuilder)
 from zorg.buildbot.builders import NightlytestBuilder
 
+from zorg.buildbot.builders import ScriptedBuilder
+reload(ScriptedBuilder)
+from zorg.buildbot.builders import ScriptedBuilder
+
+from buildbot.steps.source import SVN
+
 # Plain LLVM builders.
 def _get_llvm_builders():
     return [
@@ -247,21 +253,38 @@
                                                          extra_configure_args=['--disable-multilib']),
          'category' : 'llvm-gcc.exp' },
 
-        {'name' : "llvm-gcc-x86_64-darwin10-cross-mingw32",
-         'slavenames':["kistanova1"],
-         'builddir': "llvm-gcc-x86_64-darwin10-cross-mingw32",
-         'factory':LLVMGCCBuilder.getLLVMGCCBuildFactory(
-                16, build='x86_64-apple-darwin10',
-                host='i686-pc-mingw32',
-                target='i686-pc-mingw32',
-                useTwoStage=False,
-                extra_configure_args=['--disable-multilib', '--disable-nls', '--disable-shared',
-                                      '--disable-sjlj-exceptions', '--disable-__cxa_atexit',
-                                      '--with-local-prefix=/tools'],
-                verbose=True,
-                env={ 'PATH' : '/cross-tools/bin:/usr/bin:/bin:/usr/sbin:/sbin' },
-                ),
-         'category':'llvm-gcc'},
+        {'name'      : "llvm-gcc-x86_64-darwin10-cross-mingw32",
+         'slavenames': [ "kistanova1" ],
+         'builddir'  : "llvm-gcc-x86_64-darwin10-cross-mingw32",
+         'factory'   : ScriptedBuilder.getScriptedBuildFactory(
+                       source_code  = [SVN(name='svn-llvm',
+                                           mode='update', baseURL='http://llvm.org/svn/llvm-project/llvm/',
+                                           defaultBranch='trunk',
+                                           workdir="llvm.src"),
+                                       SVN(name='svn-llvm-gcc',
+                                           mode='update', baseURL='http://llvm.org/svn/llvm-project/llvm-gcc-4.2/',
+                                           defaultBranch='trunk',
+                                           workdir="llvm-gcc.src"),],
+                       launcher     = 'llvm-gcc.src/extras/buildbot-launcher',
+                       build_script = 'llvm-gcc.src/extras/build-4-mingw32',
+                       extra_args   = [],
+                       build_steps  = [{'name'          : 'configure_llvm',
+                                        'description'   : 'Configure LLVM',
+                                        'haltOnFailure' : True },
+                                       {'name'          : 'make_llvm',
+                                        'description'   : 'Make LLVM',
+                                        'extra_args'    : ['-j8'],  # Extra step-specific properties
+                                        'haltOnFailure' : True },
+                                       {'name'          : 'configure_llvmgcc',
+                                        'description'   : 'Configure LLVM-GCC',
+                                        'haltOnFailure' : True },
+                                       {'name'          : 'make_llvmgcc',
+                                        'description'   : 'Make LLVM-GCC',
+                                        'haltOnFailure' : True },
+                                       {'name'          : 'install_llvmgcc',
+                                        'description'   : 'Install LLVM-GCC',
+                                        'haltOnFailure' : True },]),
+         'category'  : 'llvm-gcc' },
 
         {'name' : "clang-i686-linux-selfhost-rel",
          'slavenames' : ["osu8"],

Added: zorg/trunk/zorg/buildbot/builders/ScriptedBuilder.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/ScriptedBuilder.py?rev=103396&view=auto
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/ScriptedBuilder.py (added)
+++ zorg/trunk/zorg/buildbot/builders/ScriptedBuilder.py Mon May 10 02:19:59 2010
@@ -0,0 +1,105 @@
+import buildbot
+from buildbot.steps.shell import ShellCommand, SetProperty
+from buildbot.process.properties import WithProperties
+
+def getScriptedBuildFactory(
+                      source_code  = [],   # List of source code check out commands.
+                      launcher     = None, # Build script launcher name.
+                      build_script = None, # Build script name or common prefix.
+                      extra_args   = [],   # Extra args common for all steps.
+                      build_steps  = [],   # List of step commands.
+                      env          = {}):  # Environmental variables for all steps.
+
+    # Validate input parameters
+    if not launcher:
+      raise ValueError,"Must specify launcher."
+    if not build_script:
+      raise ValueError,"Must specify build_script."
+
+    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     = "."))
+
+    # Get all the source code we need for this build
+    for checkout in source_code:
+
+      # Figure out from the source code check out commands where
+      # llvm and llvm-gcc source code directories are.
+      if checkout.name == 'svn-llvm':
+        llvm_src_dir = checkout.args.get('workdir', None)
+      elif checkout.name == 'svn-llvm-gcc':
+        llvm_gcc_src_dir = checkout.args.get('workdir', None)
+
+      f.addStep(checkout)
+
+    assert llvm_src_dir,     \
+      "Cannot retrieve where llvm source code gets checked out to."
+    assert llvm_gcc_src_dir, \
+      "Cannot retrieve where llvm-gcc source code gets checked out to."
+
+    # Run build script for each requested step
+    for step_params in build_steps:
+      # TODO: Validate type step_params is dict 
+
+      # Handle some of the parameters here.
+      scripted_step_name            = step_params.pop('name',            None)
+      scripted_step_description     = step_params.pop('description',     None)
+      scripted_step_descriptionDone = step_params.pop('descriptionDone', None)
+      scripted_step_extra_args      = step_params.pop('extra_args',      [])
+      scripted_step_env             = step_params.pop('env',             {})
+      # The rest will pass through.
+
+      assert 'command' not in step_params, "Command is generated, please do not specify it."
+
+      # scripted_step_extra_args must be a list
+      if isinstance(scripted_step_extra_args, str):
+          scripted_step_extra_args = [scripted_step_extra_args]
+
+      # Combine together common env and step-specific env
+      scripted_step_env.update(env)
+      step_params['env'] = scripted_step_env
+
+      f.addStep(
+        ShellCommand(
+          name            = "run.build.step." + scripted_step_name,
+          description     = scripted_step_description,
+          descriptionDone = scripted_step_descriptionDone,
+          command = (
+            [WithProperties("%(builddir)s/"      + launcher)] +
+            [WithProperties(build_script)]       +  # Build script to launch
+            [WithProperties(llvm_src_dir)]       +  # TODO: Escape spaces and special charactes
+            [WithProperties(llvm_gcc_src_dir)]   +  # TODO: Escape spaces and special charactes
+            [WithProperties("%(builddir)s")]     +  # TODO: Escape spaces and special charactes
+            [WithProperties(scripted_step_name)] +  # The requested step name
+            scripted_step_extra_args             +  # Step-specific extra args 
+            extra_args                              # Common extra args
+          ),
+          **step_params))
+
+    if len(build_steps) == 0: # If no steps were defined.
+
+      # Run the build_script once
+      f.addStep(
+          ShellCommand(
+            name="run.build.script",
+            command=(
+              [WithProperties("%(builddir)s/"    + launcher)] +
+              [WithProperties(build_script)]     +  # Build script to launch
+              [WithProperties(llvm_src_dir)]     +  # TODO: Escape spaces and special charactes
+              [WithProperties(llvm_gcc_src_dir)] +  # TODO: Escape spaces and special charactes
+              [WithProperties("%(builddir)s")]   +  # TODO: Escape spaces and special charactes
+            extra_args                              # Common extra args
+            ),
+            haltOnFailure = True,
+            description   = "Run build script",
+            workdir       = ".",
+            env           = env))
+
+    return f





More information about the llvm-commits mailing list