Skip to content

Commit

Permalink
Merge branch 'slavedir2' of git://github.com/maruel/buildbot
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin J. Mitchell committed Dec 1, 2009
2 parents 765c1da + 99d65c9 commit cd1a02e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
10 changes: 9 additions & 1 deletion buildbot/master.py
Expand Up @@ -647,8 +647,16 @@ def loadConfig(self, f):
slavenames = [s.slavename for s in slaves]
buildernames = []
dirnames = []

# Remove potentially harmful characters from builder name if it is to be
# used as the build dir.
badchars_map = string.maketrans("\t !#$%&'()*+,./:;<=>?@[\\]^{|}~",
"______________________________")
def safeTranslate(str):
if isinstance(str, unicode):
str = str.encode('utf8')
return str.translate(badchars_map)

for b in builders:
if type(b) is tuple:
raise ValueError("builder %s must be defined with a dict, "
Expand All @@ -666,7 +674,7 @@ def loadConfig(self, f):
buildernames.append(b['name'])

# Fix the dictionnary with default values.
b.setdefault('builddir', b['name'].translate(badchars_map))
b.setdefault('builddir', safeTranslate(b['name']))
b.setdefault('slavebuilddir', b['builddir'])
if b['builddir'] in dirnames:
raise ValueError("builder %s reuses builddir %s"
Expand Down
11 changes: 6 additions & 5 deletions buildbot/test/test_vc.py
@@ -1,4 +1,5 @@
# -*- test-case-name: buildbot.test.test_vc -*-
# -*- coding: utf-8 -*-

import sys, os, time, re
from email.Utils import mktime_tz, parsedate_tz
Expand Down Expand Up @@ -64,7 +65,7 @@
c = {}
c['slaves'] = [BuildSlave('bot1', 'sekrit')]
c['schedulers'] = []
c['builders'] = [{'name': 'vc', 'slavename': 'bot1',
c['builders'] = [{'name': '', 'slavename': 'bot1',
'builddir': 'vc-dir', 'factory': f1}]
c['slavePortnum'] = 0
# do not compress logs in tests
Expand Down Expand Up @@ -429,7 +430,7 @@ def connectSlave(self):
self.slavebase, keepalive=0, usePTY=False)
self.slave = slave
slave.startService()
d = self.master.botmaster.waitUntilBuilderAttached("vc")
d = self.master.botmaster.waitUntilBuilderAttached("")
return d

def loadConfig(self, config):
Expand All @@ -438,7 +439,7 @@ def loadConfig(self, config):
# to stop and restart the slave.
d = defer.succeed(None)
if self.slave:
d = self.master.botmaster.waitUntilBuilderDetached("vc")
d = self.master.botmaster.waitUntilBuilderDetached("")
self.slave.stopService()
d.addCallback(lambda res: self.master.loadConfig(config))
d.addCallback(lambda res: self.connectSlave())
Expand All @@ -459,7 +460,7 @@ def doBuild(self, shouldSucceed=True, ss=None):
#print "doBuild(ss: b=%s rev=%s)" % (ss.branch, ss.revision)
req = base.BuildRequest("test_vc forced build", ss, 'test_builder')
d = req.waitUntilFinished()
c.getBuilder("vc").requestBuild(req)
c.getBuilder("").requestBuild(req)
d.addCallback(self._doBuild_1, shouldSucceed)
return d
def _doBuild_1(self, bs, shouldSucceed):
Expand Down Expand Up @@ -1076,7 +1077,7 @@ def tearDown(self):
self.tearDownSignalHandler()
d = defer.succeed(None)
if self.slave:
d2 = self.master.botmaster.waitUntilBuilderDetached("vc")
d2 = self.master.botmaster.waitUntilBuilderDetached("")
d.addCallback(lambda res: self.slave.stopService())
d.addCallback(lambda res: d2)
if self.master:
Expand Down

0 comments on commit cd1a02e

Please sign in to comment.