[Buildbot-devel] workdir Usage

David A. Greene greened at obbligato.org
Mon Dec 1 18:10:33 UTC 2008


The workdir parameter to Shell-derived BuildSteps isn't well documented.
Does the BuildStep automatically create the directory?

I have a complex build composed of a bunch of different steps.  There are two
separate source trees to check out and two separate builds (one for each 
tree).  I want to check out each tree into different subdirectories and do 
each build in a subdirectory separate from the source (class GNU 
autoconf-based build).  Is it possible to use workdir to accomplish this?

Currently, the very ugly build recipie looks like this:

  f = factory.BuildFactory()
  f.addStep(ShellCommand(command=["mkdir", "-p", "./build-llvm-initial/src"]))
  f.addStep(ShellCommand(command=["mkdir", "-p", "./build-llvm-initial/obj"]))
  f.addStep(ShellCommand(command=["mkdir", "-p", "./build-llvm-final/src"]))
  f.addStep(ShellCommand(command=["mkdir", "-p", "./build-llvm-final/obj"]))
  f.addStep(ShellCommand(command=["mkdir", "-p", "./build-llvm/install"]))
  f.addStep(ShellCommand(command=["mkdir", "-p", "./build-llvm-gcc-4.2/src"]))
  f.addStep(ShellCommand(command=["mkdir", "-p", "./build-llvm-gcc-4.2/obj"]))
  f.addStep(ShellCommand(command=["mkdir", "-p", 
"./build-llvm-gcc-4.2/install"]))
  # Build initial llvm
  f.addStep(ShellCommand(command=["cd", "./build-llvm-initial/src"]))
  f.addStep(SVN(mode='clobber', 
baseURL='http://llvm.org/svn/llvm-project/llvm/', defaultBranch='trunk'))
  f.addStep(ShellCommand(command=["cd", "../obj"]))
  f.addStep(Configure(command=["../src/configure", "--prefix=../install", 
optimized, assertions, expensive]))
  f.addStep(WarningCountingShellCommand, name = "initial-llvm_clean", 
command="make clean", haltOnFailure = True, description="cleaning initial 
llvm", descriptionDone="clean initial llvm")
  f.addStep(WarningCountingShellCommand, name = "initial-llvm_compile", 
command="nice -n 10 make -j%d" % jobs, haltOnFailure = True, 
description="compiling initial llvm", descriptionDone="compile initial llvm")
  f.addStep(DejaGNUTester("initial-llvm"))
  # Build llvm-gcc-4.2
  f.addStep(ShellCommand(command=["cd", "../../llvm-gcc-4.2/src"]))
  f.addStep(SVN(mode='clobber', 
baseURL='http://llvm.org/svn/llvm-project/llvm-gcc-4.2/', 
defaultBranch='trunk'))
  f.addStep(ShellCommand(command=["cd", "../obj"]))
  checking=""
  if optimized == "--disable-optimized":
    checking="--enable-checking"
  f.addStep(Configure(command=["../src/configure", "--prefix=../install", 
"--program-prefix=llvm-", "--enable-llvm=../../build-llvm/obj", 
"--enable-languages=c,c++", checking]))
  f.addStep(WarningCountingShellCommand, name = "llvm-gcc-4.2_clean", 
command="make clean", haltOnFailure = True, description="cleaning 
llvm-gcc-4.2", descriptionDone="clean llvm-gcc-4.2")
  f.addStep(WarningCountingShellCommand, name = "llvm-gcc-4.2_compile", 
command="nice -n 10 make -j%d bootstrap" % jobs, haltOnFailure = True, 
description="compiling llvm-gcc-4.2", descriptionDone="compile llvm-gcc-4.2")
  f.addStep(WarningCountingShellCommand, name = "llvm-gcc-4.2_install", 
command="nice -n 10 make install", haltOnFailure = True, 
description="installing llvm-gcc-4.2", descriptionDone="install 
llvm-gcc-4.2")
  f.addStep(DejaGNUTester("llvm-gcc-4.2"))
  # Build final llvm
  f.addStep(ShellCommand(command=["cd", "../../build-llvm-final/src"]))
  f.addStep(SVN(mode='clobber', 
baseURL='http://llvm.org/svn/llvm-project/llvm/', defaultBranch='trunk'))
  f.addStep(ShellCommand(command=["cd", "projects"]))
  f.addStep(SVN(mode='clobber', 
baseURL='http://llvm.org/svn/llvm-project/test-suite/', 
defaultBranch='trunk'))
  f.addStep(ShellCommand(command=["cd", "../../obj"]))
  f.addStep(Configure(command=["../src/configure", "--prefix=../install", 
"--with-llvmgccdir=../../llvm-gcc-4.2/install", optimized, assertions, 
expensive]))
  f.addStep(WarningCountingShellCommand, name = "final-llvm_clean", 
command="make clean", haltOnFailure = True, description="cleaning final 
llvm", descriptionDone="clean final llvm")
  f.addStep(WarningCountingShellCommand, name = "final-llvm_compile", 
command="nice -n 10 make -j%d" % jobs, haltOnFailure = True, 
description="compiling final llvm", descriptionDone="compile final llvm")
  f.addStep(DejaGNUTester("final-llvm"))
  # Run llvm-test
  f.addStep(ShellCommand(command=["cd", "./projects/test-suite"]))
  f.addStep(WarningCountingShellCommand, name = "llvm-test", command="nice -n 
10 make", haltOnFailure = True, description="running llvm-test", 
descriptionDone="run llvm-test")

I don't know if sending all those "cd" shell commands will actually work, 
especially with the SVN steps.

Any help is greatly appreciated.

                                              -Dave




More information about the devel mailing list