[Buildbot-commits] buildbot/buildbot master.py,1.59,1.60

Brian Warner warner at users.sourceforge.net
Fri Apr 22 03:55:54 UTC 2005


Update of /cvsroot/buildbot/buildbot/buildbot
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv373/buildbot

Modified Files:
	master.py 
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-63
Creator:  Brian Warner <warner at monolith.lothar.com>

deprecation warnings

2005-04-21  Brian Warner  <warner at lothar.com>

   * Makefile: minor tweaks

   * NEWS: point out deprecation warnings, new features for
   /usr/bin/buildbot

   * buildbot/master.py (BuildMaster.loadConfig): emit
   DeprecationWarnings for Builders defined with tuples. Rearrange
   code to facility removal of deprecated configuration keys in the
   next release.


Index: master.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/master.py,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- master.py	19 Apr 2005 07:45:20 -0000	1.59
+++ master.py	22 Apr 2005 03:55:52 -0000	1.60
@@ -674,10 +674,11 @@
             log.err("config file must define BuildmasterConfig")
             raise
 
-        known_keys = "bots sources builders slavePortnum irc " + \
-                     "webPortnum webPathname debugPassword manhole " + \
+        known_keys = "bots sources builders slavePortnum " + \
+                     "debugPassword manhole " + \
                      "interlocks status projectName projectURL buildbotURL"
-        known_keys = known_keys.split()
+        deprecated_keys = "webPortnum webPathname irc"
+        known_keys = (known_keys + " " + deprecated_keys).split()
         for k in config.keys():
             if k not in known_keys:
                 log.msg("unknown key '%s' defined in config dictionary" % k)
@@ -728,12 +729,30 @@
             raise TypeError, "webPortnum '%s' must be an int" % webPortnum
         for s in status:
             assert interfaces.IStatusReceiver(s)
-        if 0: # tuple-specified builders are a problem
-            slavenames = [name for name,pw in bots]
-            for b in builders:
-                if b['slavename'] not in slavenames:
-                    raise ValueError("builder %s uses undefined slave %s" \
-                                     % (b['name'], b['slavename']))
+
+        slavenames = [name for name,pw in bots]
+        buildernames = []
+        dirnames = []
+        for b in builders:
+            if type(b) is tuple:
+                warnings.warn("defining builder %s with a tuple is deprecated"
+                              ", please use a dict instead" % b[0],
+                              DeprecationWarning)
+                continue
+            if type(b) is tuple:
+                raise ValueError("builder %s must be defined with a dict, "
+                                 "not a tuple" % b[0])
+            if b['slavename'] not in slavenames:
+                raise ValueError("builder %s uses undefined slave %s" \
+                                 % (b['name'], b['slavename']))
+            if b['name'] in buildernames:
+                raise ValueError("duplicate builder name %s"
+                                 % b['name'])
+            buildernames.append(b['name'])
+            if b['builddir'] in dirnames:
+                raise ValueError("builder %s reuses builddir %s"
+                                 % (b['name'], b['builddir']))
+            dirnames.append(b['builddir'])
 
         # now we're committed to implementing the new configuration, so do
         # it atomically
@@ -826,8 +845,7 @@
         newNames = []
         newList = {}
         for data in newBuilders:
-            if type(data) == type(()):
-                # TODO: DeprecationWarning
+            if type(data) is tuple:
                 name, slavename, builddir, factory = data
                 data = {'name': name,
                         'slavename': slavename,





More information about the Commits mailing list