[cig-commits] r7097 - in cs/buildbot/trunk/buildbot: . steps

leif at geodynamics.org leif at geodynamics.org
Thu Jun 7 17:58:18 PDT 2007


Author: leif
Date: 2007-06-07 17:58:18 -0700 (Thu, 07 Jun 2007)
New Revision: 7097

Modified:
   cs/buildbot/trunk/buildbot/bs.py
   cs/buildbot/trunk/buildbot/steps/shell.py
Log:
Installing PETSc to a secondary location using "--prefix"/"make install"
doesn't work with PyLith:

meshio/SolutionIOVTK.cc:17:51: src/dm/mesh/meshvtk.h: No such file or directory

I happen to think the above #include line is in poor taste.  (If
'meshvtk.h' is a public header, shouldn't it be copied to an include
directory?)  But Matt says "make install" is fundamentally broken for
PETSc anyway.  So, who am I to argue?

So BuildBot no longer "installs" PETSc.  In order to maintain the
insulation between the petsc-dev build and the PyLith build, I
implemented a build-rotation scheme for PETSc.  Happily, I discovered
that BuildBot can interpolate things like the build number into
commands using 'WithProperties'.  I extended this feature so that it
also interpolates into 'workdir'.


Modified: cs/buildbot/trunk/buildbot/bs.py
===================================================================
--- cs/buildbot/trunk/buildbot/bs.py	2007-06-08 00:42:59 UTC (rev 7096)
+++ cs/buildbot/trunk/buildbot/bs.py	2007-06-08 00:58:18 UTC (rev 7097)
@@ -2,6 +2,7 @@
 
 from buildbot.process import step
 from buildbot.process.factory import s
+from buildbot.steps.shell import WithProperties
 
 
 class BuildSystem(object): # BuildFactory?
@@ -161,7 +162,8 @@
 class ASEBuildSystem(BuildSystem):
     """ANL SIDL Environment (ASE) BuildSystem (used by PETSc)"""
 
-    def __init__(self, location=None):
+    def __init__(self, pseudoPrefix, location=None):
+        self.pseudoPrefix = pseudoPrefix
         self.location = location
 
     def generativeSteps(self, buildEnv, buildConfig, env, desc, workdir, configureArgs, line):
@@ -175,9 +177,34 @@
     def buildSteps(self, buildEnv, buildConfig, env, desc, workdir, configureArgs, line):
 
         configureArgs = self.configureArgs(buildEnv, buildConfig, env, configureArgs, line)
+
+        # Matt Knepley says to not use "--prefix" or "make install":
+        # "I have begged them to take out that option, but there is a
+        # stubborn insistence on it from the Debian community so they
+        # leave it in. It is fundamentally broken in that external
+        # packages are not 'installed' in any sense, and makefile
+        # paths are not altered by the install."
+
+        # We therefore do an in-place install of PETSc.  In order to
+        # insulate dependent packages from PETSc build failures
+        # (petsc-dev build failures in particular), we also implement
+        # a build rotation scheme.
+
+        from os.path import dirname
+        workbase = workdir
+        workdir = WithProperties(workdir + "-%d", "buildnumber")
+        pseudoPrefixParent = dirname(self.pseudoPrefix)
         
         steps = [
             s(step.ShellCommand,
+              description=["moving"] + desc,
+              descriptionDone=desc + ["moved"],
+              command=["mv", workbase, workdir],
+              workdir=".",
+              env=env,
+              haltOnFailure=True,
+              ),
+            s(step.ShellCommand,
               description=["configure"] + desc,
               descriptionDone=desc + ["configuration"],
               command=["./config/configure.py"] + configureArgs,
@@ -194,13 +221,62 @@
               env=env,
               timeout=3600, # Building Sieve takes a long time...
               ),
-            s(step.Compile,
-              description=["installing"] + desc,
-              descriptionDone=desc + ["installation"],
-              command=["make", "install"],
+            s(step.ShellCommand,
+              description=["being paranoid"] + desc,
+              descriptionDone=desc + ["paranoia"],
+              command=["rm", "-rf", "__rename__"],
+              workdir=".",
+              env=env,
+              haltOnFailure=True,
+              ),
+            s(step.ShellCommand,
+              description=["moving"] + desc,
+              descriptionDone=desc + ["moved"],
+              command=["mv", workdir, "__rename__"],
+              workdir=".",
+              env=env,
+              haltOnFailure=True,
+              ),
+            s(step.ShellCommand,
+              description=["nuking old builds"] + desc,
+              descriptionDone=desc + ["nuked old builds"],
+              command=("rm -rf %s*" % workbase),
+              workdir=".",
+              env=env,
+              haltOnFailure=True,
+              ),
+            s(step.ShellCommand,
+              description=["moving"] + desc,
+              descriptionDone=desc + ["moved"],
+              command=["mv", "__rename__", workdir],
+              workdir=".",
+              env=env,
+              haltOnFailure=True,
+              ),
+            s(step.ShellCommand,
+              description=["nuking prefix"] + desc,
+              descriptionDone=desc + ["nuked prefix"],
+              command=["rm", "-rf", self.pseudoPrefix],
               workdir=workdir,
               env=env,
+              haltOnFailure=True,
               ),
+            s(step.ShellCommand,
+              description=["mkparenting"] + desc,
+              descriptionDone=desc + ["mkparent"],
+              command=["mkdir", "-p", pseudoPrefixParent],
+              workdir=workdir,
+              env=env,
+              haltOnFailure=True,
+              ),
+            s(step.ShellCommand,
+              description=["symlinking"] + desc,
+              descriptionDone=desc + ["symlink"],
+              command=["ln", "-s", "%(WORKDIR)s", self.pseudoPrefix],
+              workdir=workdir,
+              env=env,
+              haltOnFailure=True,
+              ),
             ]
         
         return steps

Modified: cs/buildbot/trunk/buildbot/steps/shell.py
===================================================================
--- cs/buildbot/trunk/buildbot/steps/shell.py	2007-06-08 00:42:59 UTC (rev 7096)
+++ cs/buildbot/trunk/buildbot/steps/shell.py	2007-06-08 00:58:18 UTC (rev 7097)
@@ -110,7 +110,6 @@
         LoggingBuildStep.__init__(self, **buildstep_kwargs)
 
         # everything left over goes to the RemoteShellCommand
-        kwargs['workdir'] = workdir # including a copy of 'workdir'
         self.remote_kwargs = kwargs
 
 
@@ -151,17 +150,22 @@
             return ["'%s" % words[0], "%s'" % words[1]]
         return ["'%s" % words[0], "%s" % words[1], "...'"]
 
-    def _interpolateProperties(self, command):
+    def _interpolateProperties(self, command, workdir):
         # interpolate any build properties into our command
-        if not isinstance(command, (list, tuple)):
-            return command
-        command_argv = []
-        for argv in command:
-            if isinstance(argv, WithProperties):
-                command_argv.append(argv.render(self.build))
-            else:
-                command_argv.append(argv)
-        return command_argv
+        if isinstance(command, (list, tuple)):
+            command_argv = []
+            for argv in command:
+                if isinstance(argv, WithProperties):
+                    command_argv.append(argv.render(self.build))
+                else:
+                    command_argv.append(argv)
+            command = command_argv
+        elif isinstance(command, WithProperties):
+            command = command.render(self.build)
+        # interpolate any build properties into our workdir
+        if isinstance(workdir, WithProperties):
+            workdir = workdir.render(self.build)
+        return command, workdir
 
     def setupEnvironment(self, cmd):
         # merge in anything from Build.slaveEnvironment . Earlier steps
@@ -202,12 +206,13 @@
         # this block is specific to ShellCommands. subclasses that don't need
         # to set up an argv array, an environment, or extra logfiles= (like
         # the Source subclasses) can just skip straight to startCommand()
-        command = self._interpolateProperties(self.command)
+        command, workdir = self._interpolateProperties(self.command, self.workdir)
         assert isinstance(command, (list, tuple, str))
         # create the actual RemoteShellCommand instance now
         kwargs = self.remote_kwargs
         kwargs['command'] = command
         kwargs['logfiles'] = self.logfiles
+        kwargs['workdir'] = workdir
         cmd = RemoteShellCommand(**kwargs)
         self.setupEnvironment(cmd)
         self.checkForOldSlaveAndLogfiles()



More information about the cig-commits mailing list