Created
March 24, 2011 15:17
-
-
Save tomprince/885225 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/master/buildbot/clients/tryclient.py b/master/buildbot/clients/tryclient.py | |
index e9fa2ff..5a1b078 100644 | |
--- a/master/buildbot/clients/tryclient.py | |
+++ b/master/buildbot/clients/tryclient.py | |
@@ -252,6 +252,17 @@ class GitExtractor(SourceStampExtractor): | |
self.baserev = res.strip() | |
def parseStatus(self, res): | |
+ # If a branch is specified, parse out the rev it points to | |
+ # and extract the local name (assuming it has a slash). | |
+ # This may break if someone specifies the name of a local | |
+ # branch that has a slash in it and has no corresponding | |
+ # remote branch (or something similarly contrived). | |
+ if self.branch: | |
+ d = self.dovc(["rev-parse", self.branch]) | |
+ if '/' in self.branch: | |
+ self.branch = self.branch.split('/', 1)[1] | |
+ d.addCallback(self.override_baserev) | |
+ return d | |
# The current branch is marked by '*' at the start of the | |
# line, followed by the branch name and the SHA1. | |
# | |
@@ -259,20 +270,8 @@ class GitExtractor(SourceStampExtractor): | |
m = re.search(r'^\* (\S+)\s+([0-9a-f]{40})', res, re.MULTILINE) | |
if m: | |
self.baserev = m.group(2) | |
- # If a branch is specified, parse out the rev it points to | |
- # and extract the local name (assuming it has a slash). | |
- # This may break if someone specifies the name of a local | |
- # branch that has a slash in it and has no corresponding | |
- # remote branch (or something similarly contrived). | |
- if self.branch: | |
- d = self.dovc(["rev-parse", self.branch]) | |
- if '/' in self.branch: | |
- self.branch = self.branch.split('/', 1)[1] | |
- d.addCallback(self.override_baserev) | |
- return d | |
- else: | |
- self.branch = m.group(1) | |
- return self.readConfig() | |
+ self.branch = m.group(1) | |
+ return self.readConfig() | |
raise IndexError("Could not find current GIT branch: %s" % res) | |
def getPatch(self, res): | |
@@ -426,6 +425,8 @@ class Try(pb.Referenceable): | |
diff = sys.stdin.read() | |
else: | |
diff = open(difffile,"r").read() | |
+ if not diff: | |
+ diff = None | |
patch = (self.config['patchlevel'], diff) | |
ss = SourceStamp(branch, baserev, patch) | |
d = defer.succeed(ss) | |
diff --git a/master/buildbot/process/build.py b/master/buildbot/process/build.py | |
index 795425d..15295c2 100644 | |
--- a/master/buildbot/process/build.py | |
+++ b/master/buildbot/process/build.py | |
@@ -183,6 +183,12 @@ class Build: | |
# object that came from the config, and get its properties | |
buildslave_properties = slavebuilder.slave.properties | |
self.getProperties().updateFromProperties(buildslave_properties) | |
+ try: | |
+ from twisted.python.reflect import namedModule | |
+ path = namedModule(slavebuilder.slave.slave_system + "path") # only works with posix/win32 slaves | |
+ self.setProperty("workdir", path.join(slavebuilder.slave.slave_basedir, self.builder.slavebuilddir), "slave") | |
+ except: | |
+ log.err(Failure()) | |
self.slavename = slavebuilder.slave.slavename | |
self.build_status.setSlavename(self.slavename) | |
diff --git a/master/buildbot/schedulers/triggerable.py b/master/buildbot/schedulers/triggerable.py | |
index bb6b780..68a89d6 100644 | |
--- a/master/buildbot/schedulers/triggerable.py | |
+++ b/master/buildbot/schedulers/triggerable.py | |
@@ -41,8 +41,11 @@ class Triggerable(base.BaseScheduler): | |
# note that this does not use the buildset subscriptions mechanism, as | |
# the duration of interest to the caller is bounded by the lifetime of | |
# this process. | |
- d = self.addBuildsetForSourceStamp(reason=self.reason, ssid=ssid, | |
- properties=props) | |
+ if ssid: | |
+ d = self.addBuildsetForSourceStamp(reason=self.reason, ssid=ssid, | |
+ properties=props) | |
+ else: | |
+ d = self.addBuildsetForLatest(reason=self.reason, properties=props) | |
def setup_waiter(bsid): | |
self._waiters[bsid] = d = defer.Deferred() | |
self._updateWaiters() | |
diff --git a/master/buildbot/status/web/base.py b/master/buildbot/status/web/base.py | |
index ac407a7..df3d27e 100644 | |
--- a/master/buildbot/status/web/base.py | |
+++ b/master/buildbot/status/web/base.py | |
@@ -66,7 +66,7 @@ Fetch custom build properties from the HTTP request of a "Force build" or | |
Check the names for valid strings, and return None if a problem is found. | |
Return a new Properties object containing each property found in req. | |
""" | |
- properties = Properties() | |
+ properties = {} | |
i = 1 | |
while True: | |
pname = req.args.get("property%dname" % i, [""])[0] | |
@@ -77,7 +77,7 @@ Return a new Properties object containing each property found in req. | |
or not re.match(r'^[\w\.\-\/\~:]*$', pvalue): | |
log.msg("bad property name='%s', value='%s'" % (pname, pvalue)) | |
return None | |
- properties.setProperty(pname, pvalue, "Force Build Form") | |
+ properties[pname] = pvalue, "Force Build Form" | |
i = i + 1 | |
return properties | |
diff --git a/master/buildbot/status/web/builder.py b/master/buildbot/status/web/builder.py | |
index 4cee3bc..6a25a3f 100644 | |
--- a/master/buildbot/status/web/builder.py | |
+++ b/master/buildbot/status/web/builder.py | |
@@ -162,7 +162,7 @@ class StatusResourceBuilder(HtmlResource, BuildLineMixin): | |
% (html.escape(name), html.escape(reason))) | |
return master.addBuildset( | |
builderNames=[self.builder_status.getName()], | |
- ssid=ssid, reason=r, properties=None) | |
+ ssid=ssid, reason=r, properties=properties) | |
d.addCallback(make_buildset) | |
d.addErrback(log.err, "(ignored) while trying to force build") | |
# send the user back to the builder page | |
diff --git a/master/buildbot/steps/slave.py b/master/buildbot/steps/slave.py | |
index bdb0576..5bab972 100644 | |
--- a/master/buildbot/steps/slave.py | |
+++ b/master/buildbot/steps/slave.py | |
@@ -56,19 +56,21 @@ class FileExists(BuildStep): | |
haltOnFailure = True | |
flunkOnFailure = True | |
+ invert = False | |
- | |
- def __init__(self, file, **kwargs): | |
+ def __init__(self, file, invert=False, **kwargs): | |
BuildStep.__init__(self, **kwargs) | |
- self.addFactoryArguments(file = file) | |
+ self.addFactoryArguments(file = file, invert = invert) | |
self.file = file | |
+ self.invert = invert | |
def start(self): | |
slavever = self.slaveVersion('stat') | |
if not slavever: | |
raise BuildSlaveTooOldError("slave is too old, does not know " | |
"about stat") | |
- cmd = LoggedRemoteCommand('stat', {'file': self.file }) | |
+ properties = self.build.getProperties() | |
+ cmd = LoggedRemoteCommand('stat', {'file': properties.render(self.file) }) | |
d = self.runCommand(cmd) | |
d.addCallback(lambda res: self.commandComplete(cmd)) | |
d.addErrback(self.failed) | |
@@ -76,11 +78,12 @@ class FileExists(BuildStep): | |
def commandComplete(self, cmd): | |
if cmd.rc != 0: | |
self.step_status.setText(["File not found."]) | |
- self.finished(FAILURE) | |
+ self.finished(SUCCESS if self.invert else FAILURE) | |
+ return | |
s = cmd.updates["stat"][-1] | |
if stat.S_ISREG(s[stat.ST_MODE]): | |
self.step_status.setText(["File found."]) | |
- self.finished(SUCCESS) | |
+ self.finished(FAILURE if self.invert else SUCCESS) | |
else: | |
self.step_status.setText(["Not a file."]) | |
- self.finished(FAILURE) | |
+ self.finished(SUCCESS if self.invert else FAILURE) | |
diff --git a/master/buildbot/steps/trigger.py b/master/buildbot/steps/trigger.py | |
index 93ef8a4..fe70ed9 100644 | |
--- a/master/buildbot/steps/trigger.py | |
+++ b/master/buildbot/steps/trigger.py | |
@@ -27,7 +27,7 @@ class Trigger(LoggingBuildStep): | |
flunkOnFailure = True | |
- def __init__(self, schedulerNames=[], updateSourceStamp=True, | |
+ def __init__(self, schedulerNames=[], updateSourceStamp=True, useLatest=False, | |
waitForFinish=False, set_properties={}, copy_properties=[], **kwargs): | |
""" | |
Trigger the given schedulers when this step is executed. | |
@@ -62,6 +62,7 @@ class Trigger(LoggingBuildStep): | |
assert schedulerNames, "You must specify a scheduler to trigger" | |
self.schedulerNames = schedulerNames | |
self.updateSourceStamp = updateSourceStamp | |
+ self.useLatest = useLatest | |
self.waitForFinish = waitForFinish | |
self.set_properties = set_properties | |
self.copy_properties = copy_properties | |
@@ -70,6 +71,7 @@ class Trigger(LoggingBuildStep): | |
LoggingBuildStep.__init__(self, **kwargs) | |
self.addFactoryArguments(schedulerNames=schedulerNames, | |
updateSourceStamp=updateSourceStamp, | |
+ useLatest=useLatest, | |
waitForFinish=waitForFinish, | |
set_properties=set_properties, | |
copy_properties=copy_properties) | |
@@ -127,7 +129,10 @@ class Trigger(LoggingBuildStep): | |
return self.end(FAILURE) | |
master = self.build.builder.botmaster.parent # seriously?! | |
- d = ss.getSourceStampId(master) | |
+ if self.useLatest: | |
+ d = defer.succeed(None) | |
+ else: | |
+ d = ss.getSourceStampId(master) | |
def start_builds(ssid): | |
dl = [] | |
for scheduler in triggered_schedulers: | |
diff --git a/master/buildbot/steps/vstudio.py b/master/buildbot/steps/vstudio.py | |
index 0822a67..4298cb6 100644 | |
--- a/master/buildbot/steps/vstudio.py | |
+++ b/master/buildbot/steps/vstudio.py | |
@@ -199,11 +199,16 @@ class VisualStudio(ShellCommand): | |
class VC6(VisualStudio): | |
default_installdir = 'C:\\Program Files\\Microsoft Visual Studio' | |
+ project = "ALL" | |
- def __init__(self, **kwargs): | |
+ def __init__(self, | |
+ project = "ALL", | |
+ **kwargs): | |
+ self.project = project | |
# always upcall ! | |
VisualStudio.__init__(self, **kwargs) | |
+ self.addFactoryArguments(project = project) | |
def setupEnvironment(self, cmd): | |
VisualStudio.setupEnvironment(self, cmd) | |
@@ -229,7 +234,7 @@ class VC6(VisualStudio): | |
command = ["msdev"] | |
command.append(self.projectfile) | |
command.append("/MAKE") | |
- command.append("ALL - " + self.config) | |
+ command.append(self.project + " - " + self.config) | |
if self.mode == "rebuild": | |
command.append("/REBUILD") | |
else: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment