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

leif at geodynamics.org leif at geodynamics.org
Fri Jun 1 16:57:34 PDT 2007


Author: leif
Date: 2007-06-01 16:57:34 -0700 (Fri, 01 Jun 2007)
New Revision: 7041

Modified:
   cs/buildbot/trunk/buildbot/bs.py
   cs/buildbot/trunk/buildbot/config.py
   cs/buildbot/trunk/buildbot/lines.py
   cs/buildbot/trunk/buildbot/projects.py
   cs/buildbot/trunk/buildbot/repositories.py
   cs/buildbot/trunk/buildbot/status/html.py
   cs/buildbot/trunk/buildbot/status/mail.py
   cs/buildbot/trunk/buildbot/steps/source.py
Log:
Enable petsc-dev to be checked-out from its Mercurial repository.  (In
addition, BuildBot also builds the release version of PETSc from a
tarball.)  Also: fixed the "Buildbot URL" in build failure e-mails so
that it points to the project-specific BuildBot waterfall.


Modified: cs/buildbot/trunk/buildbot/bs.py
===================================================================
--- cs/buildbot/trunk/buildbot/bs.py	2007-06-01 23:04:01 UTC (rev 7040)
+++ cs/buildbot/trunk/buildbot/bs.py	2007-06-01 23:57:34 UTC (rev 7041)
@@ -154,6 +154,17 @@
 class ASEBuildSystem(BuildSystem):
     """ANL SIDL Environment (ASE) BuildSystem (used by PETSc)"""
 
+    def __init__(self, location=None):
+        self.location = location
+
+    def generativeSteps(self, buildEnv, buildConfig, env, desc, workdir, configureArgs, line):
+        steps = []
+        if self.location:
+            steps = self.location.sourceSteps(
+                workdir = workdir + "/python/BuildSystem",
+                mode = 'clobber')
+        return steps
+
     def buildSteps(self, buildEnv, buildConfig, env, desc, workdir, configureArgs, line):
 
         configureArgs = self.configureArgs(buildEnv, buildConfig, env, configureArgs, line)
@@ -187,7 +198,7 @@
         
         return steps
 
-ase = ASEBuildSystem()
+ase = ASEBuildSystem
 
 
 class DebugBuildSystem(BuildSystem):

Modified: cs/buildbot/trunk/buildbot/config.py
===================================================================
--- cs/buildbot/trunk/buildbot/config.py	2007-06-01 23:04:01 UTC (rev 7040)
+++ cs/buildbot/trunk/buildbot/config.py	2007-06-01 23:57:34 UTC (rev 7041)
@@ -159,17 +159,20 @@
 
             line.generate(builderNames, self.schedulerKwds)
 
+            # set-up a mail notifier for this branch
             owners = line.project.owners
             if owners:
-                # set-up a mail notifier for this branch
-                mn = mail.MailNotifier(fromaddr="buildbot at geodynamics.org",
-                                       mode='failing',
-                                       extraRecipients=[user.email for user in owners],
-                                       sendToInterestedUsers=False,
-                                       builders=builderNames,
-                                       lookup=self.addressBook,
-                                       )
-                self.status.append(mn)
+                extraRecipients = [user.email for user in owners]
+            else:
+                extraRecipients = []
+            mn = mail.MailNotifier(fromaddr="buildbot at geodynamics.org",
+                                   mode='failing',
+                                   extraRecipients=extraRecipients,
+                                   builders=builderNames,
+                                   lookup=self.addressBook,
+                                   buildbotURL=line.project.buildbotURL,
+                                   )
+            self.status.append(mn)
 
         ### for line in lines
 

Modified: cs/buildbot/trunk/buildbot/lines.py
===================================================================
--- cs/buildbot/trunk/buildbot/lines.py	2007-06-01 23:04:01 UTC (rev 7040)
+++ cs/buildbot/trunk/buildbot/lines.py	2007-06-01 23:57:34 UTC (rev 7041)
@@ -2,7 +2,7 @@
 
 from buildbot.categories import Category
 from buildbot.process.factory import BuildFactory
-from buildbot.scheduler import Scheduler, Nightly, Dependent
+from buildbot.scheduler import Nightly, Dependent
 import weakref
 
 
@@ -58,7 +58,7 @@
             dep.isDependency = True
 
         # Trigger a build whenever my sources change.
-        self.changeScheduler = self.newChangeScheduler(schedulerKwds)
+        self.changeScheduler = self.newChangeScheduler(**schedulerKwds)
         if self.changeScheduler:
             self.schedulers.append(self.changeScheduler)
         
@@ -174,13 +174,13 @@
         return self.project.name + " " + self.name
 
 
-    def newChangeScheduler(self, schedulerKwds):
-        s = Scheduler(name = "change " + self.fullName(),
-                      root = self.location.root(),
-                      branch = self.location.branch(),
-                      category = self.category,
-                      builderNames = self.builderNames,
-                      **schedulerKwds)
+    def newChangeScheduler(self, **kwds):
+        s = self.location.newChangeScheduler(
+            name = "change " + self.fullName(),
+            category = self.category,
+            builderNames = self.builderNames,
+            **kwds
+            )
         return s
 
 
@@ -213,7 +213,7 @@
             location = location,
             **kwds)
 
-    def newChangeScheduler(self, schedulerKwds):
+    def newChangeScheduler(self, **kwds):
         # Releases don't change.
         return None
     

Modified: cs/buildbot/trunk/buildbot/projects.py
===================================================================
--- cs/buildbot/trunk/buildbot/projects.py	2007-06-01 23:04:01 UTC (rev 7040)
+++ cs/buildbot/trunk/buildbot/projects.py	2007-06-01 23:57:34 UTC (rev 7041)
@@ -29,6 +29,8 @@
         if self.defaultBuildSystem is None:
             self.defaultBuildSystem = gnu
 
+        self.buildbotURL = self.name.replace(' ', '_')
+
         return
 
 

Modified: cs/buildbot/trunk/buildbot/repositories.py
===================================================================
--- cs/buildbot/trunk/buildbot/repositories.py	2007-06-01 23:04:01 UTC (rev 7040)
+++ cs/buildbot/trunk/buildbot/repositories.py	2007-06-01 23:57:34 UTC (rev 7041)
@@ -2,6 +2,7 @@
 
 from copy import copy
 from buildbot.process import step
+from buildbot.scheduler import Scheduler
 
 
 class Repository(object):
@@ -18,6 +19,8 @@
             raise NotImplementedError()
         def branchLocation(self, name):
             raise NotImplementedError()
+        def newChangeScheduler(self, **kwds):
+            return None
 
     def sourceStep(self, **kwds):
         """Return a BuildStep which checks-out source from me."""
@@ -75,9 +78,14 @@
                                            **kwds)]
     def root(self): return '/'.join(self.path) + '/'
     def branch(self): return '/'.join(self.line)
+    def newChangeScheduler(self, **kwds):
+        s = Scheduler(
+            root = self.root(),
+            branch = self.branch(),
+            **kwds)
+        return s
 
 
-
 class SVNRepository(TreeRepository):
     
     Step = step.SVN
@@ -94,13 +102,20 @@
 class HGRepository(Repository):
 
     Step = step.Mercurial
+
+    class Location(Repository.Location):
+        def sourceSteps(self, **kwds):
+            return [self.repository.sourceStep(**kwds)]
     
-    def __init__(self, baseURL):
+    def __init__(self, repourl):
         Repository.__init__(self)
-        self.baseURL = baseURL
+        self.repourl = repourl
 
     def sourceStepKwds(self):
-        return {'baseURL': self.baseURL}
+        return {'repourl': self.repourl}
 
+    def location(self):
+        return self.Location(repository=self)
 
+
 # end of file

Modified: cs/buildbot/trunk/buildbot/status/html.py
===================================================================
--- cs/buildbot/trunk/buildbot/status/html.py	2007-06-01 23:04:01 UTC (rev 7040)
+++ cs/buildbot/trunk/buildbot/status/html.py	2007-06-01 23:57:34 UTC (rev 7041)
@@ -315,13 +315,13 @@
     title = "Build"
 
     def __init__(self, status, build, builderControl, buildControl,
-                 waterfallURL,  projectName):
+                 buildbotURL,  projectName):
         HtmlResource.__init__(self)
         self.status = status
         self.build = build
         self.builderControl = builderControl
         self.control = buildControl
-        self.waterfallURL = waterfallURL
+        self.buildbotURL = buildbotURL
         self.projectName = projectName
 
     def body(self, request):
@@ -330,7 +330,7 @@
             buildbotName = "%s BuildBot" % self.projectName
         else:
             buildbotName = "BuildBot"
-        data = '<div class="title"><a href="%s">%s</a></div>\n'%(self.waterfallURL,
+        data = '<div class="title"><a href="%s">%s</a></div>\n'%(self.buildbotURL,
                                                                  buildbotName)
         # the color in the following line gives python-mode trouble
         data += ("<h1>Build <a href=\"%s\">%s</a>:#%d</h1>\n"
@@ -495,13 +495,13 @@
 # $builder
 class StatusResourceBuilder(HtmlResource):
 
-    def __init__(self, status, builder, control, waterfallURL, projectName):
+    def __init__(self, status, builder, control, buildbotURL, projectName):
         HtmlResource.__init__(self)
         self.status = status
         self.title = builder.getName() + " Builder"
         self.builder = builder
         self.control = control
-        self.waterfallURL = waterfallURL
+        self.buildbotURL = buildbotURL
         self.projectName = projectName
 
     def body(self, request):
@@ -513,7 +513,7 @@
             buildbotName = "%s BuildBot" % self.projectName
         else:
             buildbotName = "BuildBot"
-        data = "<a href=\"%s\">%s</a>\n" % (self.waterfallURL, buildbotName)
+        data = "<a href=\"%s\">%s</a>\n" % (self.buildbotURL, buildbotName)
         data += make_row("Builder:", html.escape(b.getName()))
         b1 = b.getBuild(-1)
         if b1 is not None:
@@ -653,7 +653,7 @@
                     control = self.control.getBuild(num)
                 return StatusResourceBuild(self.status, build,
                                            self.control, control,
-                                           self.waterfallURL,
+                                           self.buildbotURL,
                                            self.projectName)
             else:
                 return NoResource("No such build '%d'" % num)
@@ -1587,7 +1587,7 @@
     robots_txt = None
 
     def __init__(self, status, control, changemaster, categories, css,
-                 waterfallURL, projectName, projectURL):
+                 buildbotURL, projectName, projectURL):
         """
         @type  status:       L{buildbot.status.builder.Status}
         @type  control:      L{buildbot.master.Control}
@@ -1599,7 +1599,7 @@
         self.changemaster = changemaster
         self.categories = categories
         self.css = css
-        self.waterfallURL = waterfallURL
+        self.buildbotURL = buildbotURL
         self.projectName = projectName
         self.projectURL = projectURL
         waterfall = WaterfallStatusResource(self.status, changemaster,
@@ -1634,7 +1634,7 @@
             if self.control:
                 control = self.control.getBuilder(path)
             return StatusResourceBuilder(self.status, builder, control,
-                                         self.waterfallURL, self.projectName)
+                                         self.buildbotURL, self.projectName)
 
         return NoResource("No such Builder '%s'" % path)
 
@@ -1758,11 +1758,11 @@
 
     compare_attrs = ["http_port", "distrib_port", "allowForce",
                      "categories", "css", "favicon", "robots_txt",
-                     "waterfallURL", "projectName", "projectURL"]
+                     "buildbotURL", "projectName", "projectURL"]
 
     def __init__(self, http_port=None, distrib_port=None, allowForce=True,
                  categories=None, css=buildbot_css, favicon=buildbot_icon,
-                 robots_txt=None, waterfallURL=None,
+                 robots_txt=None, buildbotURL=None,
                  projectName=None, projectURL=None,
                  ):
         """To have the buildbot run its own web server, pass a port number to
@@ -1842,7 +1842,7 @@
         self.robots_txt = robots_txt
         self.projectName = projectName
         self.projectURL = projectURL
-        self.waterfallURL = waterfallURL
+        self.buildbotURL = buildbotURL
 
     def __repr__(self):
         if self.http_port is None:
@@ -1866,9 +1866,9 @@
         else:
             control = None
         change_svc = self.parent.change_svc
-        waterfallURL = self.waterfallURL or status.getBuildbotURL()
+        buildbotURL = self.buildbotURL or status.getBuildbotURL()
         sr = StatusResource(status, control, change_svc, self.categories,
-                            self.css, waterfallURL,
+                            self.css, buildbotURL,
                             self.projectName, self.projectURL)
                             
         sr.favicon = self.favicon

Modified: cs/buildbot/trunk/buildbot/status/mail.py
===================================================================
--- cs/buildbot/trunk/buildbot/status/mail.py	2007-06-01 23:04:01 UTC (rev 7040)
+++ cs/buildbot/trunk/buildbot/status/mail.py	2007-06-01 23:57:34 UTC (rev 7041)
@@ -67,13 +67,15 @@
 
     compare_attrs = ["extraRecipients", "lookup", "fromaddr", "mode",
                      "categories", "builders", "addLogs", "relayhost",
-                     "subject", "sendToInterestedUsers"]
+                     "subject", "sendToInterestedUsers",
+                     "buildbotURL"]
 
     def __init__(self, fromaddr, mode="all", categories=None, builders=None,
                  addLogs=False, relayhost="localhost",
                  subject="buildbot %(result)s in %(builder)s",
                  lookup=None, extraRecipients=[],
-                 sendToInterestedUsers=True):
+                 sendToInterestedUsers=True,
+                 buildbotURL=None):
         """
         @type  fromaddr: string
         @param fromaddr: the email address to be used in the 'From' header.
@@ -159,6 +161,7 @@
         self.lookup = lookup
         self.watched = []
         self.status = None
+        self.buildbotURL = buildbotURL
 
         # you should either limit on builders or categories, not both
         if self.builders != None and self.categories != None:
@@ -235,7 +238,7 @@
             text += "Full details are available at:\n %s\n" % buildurl
         text += "\n"
 
-        url = self.status.getBuildbotURL()
+        url = self.buildbotURL or self.status.getBuildbotURL()
         if url:
             text += "Buildbot URL: %s\n\n" % urllib.quote(url, '/:')
 

Modified: cs/buildbot/trunk/buildbot/steps/source.py
===================================================================
--- cs/buildbot/trunk/buildbot/steps/source.py	2007-06-01 23:04:01 UTC (rev 7040)
+++ cs/buildbot/trunk/buildbot/steps/source.py	2007-06-01 23:57:34 UTC (rev 7041)
@@ -744,7 +744,8 @@
 
     name = "hg"
 
-    def __init__(self, repourl=None, baseURL=None, defaultBranch=None,
+    def __init__(self, repourl=None, baseURL=None,
+                 root=None, defaultBranch=None,
                  **kwargs):
         """
         @type  repourl: string
@@ -767,13 +768,14 @@
         """
         self.repourl = repourl
         self.baseURL = baseURL
+        self.root = root
         self.branch = defaultBranch
         Source.__init__(self, **kwargs)
         if (not repourl and not baseURL) or (repourl and baseURL):
             raise ValueError("you must provide exactly one of repourl and"
                              " baseURL")
 
-    def startVC(self, branch, revision, patch):
+    def startVC(self, root, branch, revision, patch):
         slavever = self.slaveVersion("hg")
         if not slavever:
             raise BuildSlaveTooOldError("slave is too old, does not know "
@@ -783,7 +785,7 @@
             assert not branch # we need baseURL= to use branches
             self.args['repourl'] = self.repourl
         else:
-            self.args['repourl'] = self.baseURL + branch
+            self.args['repourl'] = self.baseURL + root + branch
         self.args['revision'] = revision
         self.args['patch'] = patch
 



More information about the cig-commits mailing list