Skip to content

Commit

Permalink
Merge commit 'baed1a3ee0627b80756cf1ab8f25840c23f4f193' into jinja
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-sonestedt committed Dec 19, 2009
2 parents 64c4b59 + baed1a3 commit 0f191a6
Show file tree
Hide file tree
Showing 13 changed files with 1,401 additions and 80 deletions.
9 changes: 4 additions & 5 deletions buildbot/changes/changes.py
@@ -1,4 +1,3 @@

import sys, os, time
from cPickle import dump

Expand Down Expand Up @@ -85,8 +84,8 @@ def asText(self):
data += self.getFileContents()
data += "At: %s\n" % self.getTime()
data += "Changed By: %s\n" % self.who
data += "Comments: %s\n\n" % self.comments
data += "Properties: %s\n" % self.getProperties()
data += "Comments: %s" % self.comments
data += "Properties: \n%s\n\n" % self.getProperties()
return data

def asHTML(self):
Expand All @@ -98,15 +97,14 @@ def asHTML(self):
links.append('<a href="%s"><b>%s</b></a>' % (link[0], file))
else:
links.append('<b>%s</b>' % file)
revlink = ""
if self.revision:
if getattr(self, 'revlink', ""):
revision = 'Revision: <a href="%s"><b>%s</b></a>\n' % (
self.revlink, self.revision)
else:
revision = "Revision: <b>%s</b><br />\n" % self.revision
else:
revision = None
revision = ''

branch = ""
if self.branch:
Expand Down Expand Up @@ -179,6 +177,7 @@ def getProperties(self):
data = ""
for prop in self.properties.asList():
data += " %s: %s" % (prop[0], prop[1])
return data

class ChangeMaster(service.MultiService):

Expand Down
6 changes: 6 additions & 0 deletions buildbot/scripts/runner.py
Expand Up @@ -848,6 +848,12 @@ class TryOptions(usage.Options):
"Run the trial build on this Builder. Can be used multiple times."],
["properties", None, None,
"A set of properties made available in the build environment, format:prop=value,propb=valueb..."],

["try-topfile", None, None,
"Name of a file at the top of the tree, used to find the top. Only needed for SVN and CVS."],
["try-topdir", None, None,
"Path to the top of the working copy. Only needed for SVN and CVS."],

]

optFlags = [
Expand Down
2 changes: 1 addition & 1 deletion buildbot/scripts/tryclient.py
Expand Up @@ -415,7 +415,7 @@ def createJob(self):
vc = self.getopt("vc", "try_vc")
if vc in ("cvs", "svn"):
# we need to find the tree-top
topdir = self.getopt("try_topdir", "try_topdir")
topdir = self.getopt("try-topdir", "try_topdir")
if topdir:
treedir = os.path.expanduser(topdir)
else:
Expand Down
99 changes: 48 additions & 51 deletions buildbot/slave/commands.py
Expand Up @@ -2051,6 +2051,7 @@ class Git(SourceBase):

def setup(self, args):
SourceBase.setup(self, args)
self.vcexe = getCommand("git")
self.repourl = args['repourl']
self.branch = args.get('branch')
if not self.branch:
Expand All @@ -2072,6 +2073,17 @@ def sourcedirIsUpdateable(self):
def readSourcedata(self):
return open(self.sourcedatafile, "r").read()

def _dovccmd(self, command, cb=None, **kwargs):
c = ShellCommand(self.builder, [self.vcexe] + command, self._fullSrcdir(),
sendRC=False, timeout=self.timeout,
maxTime=self.maxTime, usePTY=False, **kwargs)
self.command = c
d = c.start()
if cb:
d.addCallback(self._abandonOnFailure)
d.addCallback(cb)
return d

# If the repourl matches the sourcedata file, then
# we can say that the sourcedata matches. We can
# ignore branch changes, since Git can work with
Expand All @@ -2086,84 +2098,69 @@ def sourcedataMatches(self):
return False
return True

def _didSubmodules(self, res):
command = ['git', 'submodule', 'update', '--init']
c = ShellCommand(self.builder, command, self._fullSrcdir(),
sendRC=False, timeout=self.timeout,
maxTime=self.maxTime, usePTY=False)
self.command = c
return c.start()
def _cleanSubmodules(self, res):
return self._dovccmd(['submodule', 'foreach', 'git', 'clean', '-dfx'])

def _updateSubmodules(self, res):
return self._dovccmd(['submodule', 'update'], self._cleanSubmodules)

def _initSubmodules(self, res):
if self.submodules:
return self._dovccmd(['submodule', 'init'], self._updateSubmodules)
else:
return defer.succeed(0)

def _didFetch(self, res):
if self.revision:
head = self.revision
else:
head = 'FETCH_HEAD'

command = ['git', 'reset', '--hard', head]
c = ShellCommand(self.builder, command, self._fullSrcdir(),
sendRC=False, timeout=self.timeout,
maxTime=self.maxTime, usePTY=False)
self.command = c
d = c.start()
if self.submodules:
d.addCallback(self._abandonOnFailure)
d.addCallback(self._didSubmodules)
return d
command = ['reset', '--hard', head]
return self._dovccmd(command, self._initSubmodules)

# Update first runs "git clean", removing local changes, This,
# combined with the later "git reset" equates clobbering the repo,
# but it's much more efficient.
def doVCUpdate(self):
command = ['git', 'clean', '-f', '-d', '-x']
c = ShellCommand(self.builder, command, self._fullSrcdir(),
sendRC=False, timeout=self.timeout,
maxTime=self.maxTime, usePTY=False)
self.command = c
d = c.start()
d.addCallback(self._abandonOnFailure)
d.addCallback(self._didClean)
return d
command = ['clean', '-f', '-d', '-x']
return self._dovccmd(command, self._didClean)

def _didClean(self, dummy):
command = ['git', 'fetch', '-t', self.repourl, self.branch]
def _doFetch(self, dummy):
command = ['fetch', '-t', self.repourl, self.branch]
self.sendStatus({"header": "fetching branch %s from %s\n"
% (self.branch, self.repourl)})
c = ShellCommand(self.builder, command, self._fullSrcdir(),
sendRC=False, timeout=self.timeout,
maxTime=self.maxTime, usePTY=False)
self.command = c
d = c.start()
d.addCallback(self._abandonOnFailure)
d.addCallback(self._didFetch)
return d
return self._dovccmd(command, self._didFetch)

def _didClean(self, dummy):
# After a clean, try to use the given revision if we have one.
if self.revision:
# We know what revision we want. See if we have it.
d = self._dovccmd(['reset', '--hard', self.revision],
self._initSubmodules)
# If we are unable to reset to the specified version, we
# must do a fetch first and retry.
d.addErrback(self._doFetch)
return d
else:
# No known revision, go grab the latest.
return self._doFetch(None)

def _didInit(self, res):
return self.doVCUpdate()

def doVCFull(self):
os.mkdir(self._fullSrcdir())
c = ShellCommand(self.builder, ['git', 'init'], self._fullSrcdir(),
sendRC=False, timeout=self.timeout,
maxTime=self.maxTime, usePTY=False)
self.command = c
d = c.start()
d.addCallback(self._abandonOnFailure)
d.addCallback(self._didInit)
return d
return self._dovccmd(['init'], self._didInit)

def parseGotRevision(self):
command = ['git', 'rev-parse', 'HEAD']
c = ShellCommand(self.builder, command, self._fullSrcdir(),
sendRC=False, keepStdout=True, usePTY=False)
d = c.start()
command = ['rev-parse', 'HEAD']
def _parse(res):
hash = c.stdout.strip()
hash = self.command.stdout.strip()
if len(hash) != 40:
return None
return hash
d.addCallback(_parse)
return d
return self._dovccmd(command, _parse, keepStdout=True)

registerSlaveCommand("git", Git, command_version)

Expand Down
1 change: 0 additions & 1 deletion buildbot/sourcestamp.py
@@ -1,4 +1,3 @@

from zope.interface import implements
from buildbot import util, interfaces

Expand Down
2 changes: 2 additions & 0 deletions buildbot/status/web/baseweb.py
Expand Up @@ -15,6 +15,7 @@
from buildbot.status.web.feeds import Rss20StatusResource, \
Atom10StatusResource
from buildbot.status.web.waterfall import WaterfallStatusResource
from buildbot.status.web.console import ConsoleStatusResource
from buildbot.status.web.grid import GridStatusResource, TransposedGridStatusResource
from buildbot.status.web.changes import ChangesResource
from buildbot.status.web.builder import BuildersResource
Expand Down Expand Up @@ -516,6 +517,7 @@ def setupUsualPages(self, numbuilds):
#self.putChild("", IndexOrWaterfallRedirection())
self.putChild("waterfall", WaterfallStatusResource())
self.putChild("grid", GridStatusResource())
self.putChild("console", ConsoleStatusResource())
self.putChild("tgrid", TransposedGridStatusResource())
self.putChild("builders", BuildersResource()) # has builds/steps/logs
self.putChild("changes", ChangesResource())
Expand Down

0 comments on commit 0f191a6

Please sign in to comment.