jhbuild r2236 - in trunk: . buildbot jhbuild/buildbot
- From: fpeters svn gnome org
- To: svn-commits-list gnome org
- Subject: jhbuild r2236 - in trunk: . buildbot jhbuild/buildbot
- Date: Thu, 14 Aug 2008 20:35:26 +0000 (UTC)
Author: fpeters
Date: Thu Aug 14 20:35:26 2008
New Revision: 2236
URL: http://svn.gnome.org/viewvc/jhbuild?rev=2236&view=rev
Log:
* jhbuild/buildbot/changes.py, jhbuild/buildbot/scheduler.py: updated
scheduler to get commit notification via svn-commits-list (untested).
* master.cfg: register for maildir source notification.
Modified:
trunk/ChangeLog
trunk/buildbot/ChangeLog
trunk/buildbot/master.cfg
trunk/jhbuild/buildbot/changes.py
trunk/jhbuild/buildbot/scheduler.py
Modified: trunk/buildbot/master.cfg
==============================================================================
--- trunk/buildbot/master.cfg (original)
+++ trunk/buildbot/master.cfg Thu Aug 14 20:35:26 2008
@@ -9,6 +9,7 @@
# dictionary has a variety of keys to control different aspects of the
# buildmaster. They are documented in docs/config.xhtml .
+import buildbot
import sys
import os
@@ -55,14 +56,16 @@
# about source code changes. Any class which implements IChangeSource can be
# put here: there are several in buildbot/changes/*.py to choose from.
-# Eventually we want to trigger builds using svn-commits-list
-# import os
-# from jhbuildbot.changes import GnomeMaildirSource
-# c['change_source'] = GnomeMaildirSource(os.path.expanduser('~/Maildir'), prefix=None)
-
-# But for now, lets just inject them
-from buildbot.changes.pb import PBChangeSource
-c['change_source'] = PBChangeSource()
+from jhbuild.buildbot.changes import GnomeMaildirSource
+if os.path.exists(os.path.expanduser('~/Maildir')):
+ # trigger builds from mails to svn-commit-list
+ # (note Maildir must be correct, or everything will fail)
+ c['change_source'] = GnomeMaildirSource(
+ os.path.expanduser('~/Maildir'), prefix=None)
+else:
+ # support injection
+ from buildbot.changes.pb import PBChangeSource
+ c['change_source'] = PBChangeSource()
# For example, if you had CVSToys installed on your repository, and your
# CVSROOT/freshcfg file had an entry like this:
Modified: trunk/jhbuild/buildbot/changes.py
==============================================================================
--- trunk/jhbuild/buildbot/changes.py (original)
+++ trunk/jhbuild/buildbot/changes.py Thu Aug 14 20:35:26 2008
@@ -32,6 +32,9 @@
# From is svnuser svn gnome org
name, domain = m["from"].split("@")
+ # Subject is project revision - etc.
+ project = m['subject'].split(' ', 1)[0]
+
# If this e-mail is valid, it will come from an svn.gnome.org email
if domain != "svn.gnome.org":
return None
@@ -68,5 +71,7 @@
if l[:-1] not in ("Added:", "Modified:", "Removed:"):
files.append(l[3:-1])
- return changes.Change(name, files, comments, isdir, revision=revision, links=links, when=when)
+ c = changes.Change(name, files, comments, isdir, revision=revision, links=links, when=when)
+ c.project = project # custom attribute
+ return c
Modified: trunk/jhbuild/buildbot/scheduler.py
==============================================================================
--- trunk/jhbuild/buildbot/scheduler.py (original)
+++ trunk/jhbuild/buildbot/scheduler.py Thu Aug 14 20:35:26 2008
@@ -16,9 +16,12 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
+
+import time
+
from twisted.application import service, internet
+from twisted.internet import reactor
from buildbot.scheduler import Periodic, BaseUpstreamScheduler
from buildbot.sourcestamp import SourceStamp
from buildbot import buildset
@@ -29,7 +32,72 @@
return StartSerial(name, project, builderNames, periodicBuildTimer, branch)
return Serial(name, project, upstream, builderNames, branch)
-class StartSerial(Periodic):
+
+class ChangeNotification:
+ fileIsImportant = None
+ treeStableTimer = 180
+
+ def __init__(self):
+ self.importantChanges = []
+ self.unimportantChanges = []
+ self.nextBuildTime = None
+ self.timer = None
+
+ def addChange(self, change):
+ log.msg('adding a change')
+ if change.project != self.project:
+ return
+ if change.branch != self.branch:
+ return
+ if not self.fileIsImportant:
+ self.addImportantChange(change)
+ elif self.fileIsImportant(change):
+ self.addImportantChange(change)
+ else:
+ self.addUnimportantChange(change)
+
+ def addImportantChange(self, change):
+ log.msg("%s: change is important, adding %s" % (self, change))
+ self.importantChanges.append(change)
+ self.nextBuildTime = max(self.nextBuildTime,
+ change.when + self.treeStableTimer)
+ self.setTimer(self.nextBuildTime)
+
+ def addUnimportantChange(self, change):
+ log.msg("%s: change is not important, adding %s" % (self, change))
+ self.unimportantChanges.append(change)
+
+ def setTimer(self, when):
+ log.msg("%s: setting timer to %s" %
+ (self, time.strftime("%H:%M:%S", time.localtime(when))))
+ now = util.now()
+ if when < now:
+ when = now + 1
+ if self.timer:
+ self.timer.cancel()
+ self.timer = reactor.callLater(when - now, self.fireTimer)
+
+ def stopTimer(self):
+ if self.timer:
+ self.timer.cancel()
+ self.timer = None
+
+ def fireTimer(self):
+ # clear out our state
+ self.timer = None
+ self.nextBuildTime = None
+ changes = self.importantChanges + self.unimportantChanges
+ self.importantChanges = []
+ self.unimportantChanges = []
+
+ # create a BuildSet, submit it to the BuildMaster
+ bs = buildset.BuildSet(self.builderNames,
+ SourceStamp(changes=changes),
+ properties=self.properties)
+ self.submitBuildSet(bs)
+
+
+class StartSerial(ChangeNotification, Periodic):
def __init__(self, name, project, builderNames, periodicBuildTimer,
branch=None):
@@ -51,7 +119,7 @@
w(ss)
Periodic.buildSetFinished(self,bss)
-class Serial(BaseUpstreamScheduler):
+class Serial(ChangeNotification, BaseUpstreamScheduler):
"""This scheduler runs some set of builds that should be run
after the 'upstream' scheduler has completed (successfully or not)."""
compare_attrs = ('name', 'upstream', 'builders', 'branch')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]