Skip to content

Commit

Permalink
Merge remote branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
brasse committed Mar 12, 2010
2 parents efe7ba8 + 6ed78f0 commit a18315b
Show file tree
Hide file tree
Showing 19 changed files with 4,556 additions and 4,465 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Expand Up @@ -8,6 +8,7 @@ include docs/images/icon.blend docs/images/Makefile
include docs/epyrun docs/gen-reference docs/Makefile
include docs/version.py

include buildbot/db/schema/tables.sql
include buildbot/scripts/sample.cfg
include buildbot/status/web/files/*
include buildbot/status/web/templates/*.html buildbot/status/web/templates/*.xml
Expand Down
3 changes: 0 additions & 3 deletions Makefile
@@ -1,4 +1,3 @@

# this is just a convenience for developers, and to automate the release
# process a little bit. This Makefile is not included in the source tarball.

Expand Down Expand Up @@ -36,8 +35,6 @@ coverage-output:
@echo "now point your browser at coverage-html/index.html"


#debuild -uc -us

deb-snapshot:
debchange --newversion `PYTHONPATH=. python -c "import buildbot; print buildbot.version"`.`date +%Y.%m.%d.%H.%M.%S` \
"snapshot build"
Expand Down
25 changes: 23 additions & 2 deletions buildbot/scripts/runner.py
Expand Up @@ -466,6 +466,8 @@ class MasterOptions(MakerBase):
optFlags = [
["force", "f",
"Re-use an existing directory (will not overwrite master.cfg file)"],
["relocatable", "r",
"Create a relocatable buildbot.tac"],
]
optParameters = [
["config", "c", "master.cfg", "name of the buildmaster config file"],
Expand All @@ -480,8 +482,11 @@ def getSynopsis(self):
return "Usage: buildbot create-master [options] [<basedir>]"

longdesc = """
This command creates a buildmaster working directory and buildbot.tac
file. The master will live in <dir> and create various files there.
This command creates a buildmaster working directory and buildbot.tac file.
The master will live in <dir> and create various files there. If
--relocatable is given, then the resulting buildbot.tac file will be
written such that its containing directory is assumed to be the basedir.
This is generally a good idea.
At runtime, the master will read a configuration file (named
'master.cfg' by default) in its basedir. This file should contain python
Expand Down Expand Up @@ -515,6 +520,11 @@ def postOptions(self):
rotateLength = %(log-size)s
maxRotatedFiles = %(log-count)s
# if this is a relocatable tac file, get the directory containing the TAC
if basedir == '.':
import os.path
basedir = os.path.abspath(os.path.dirname(__file__))
application = service.Application('buildmaster')
try:
from twisted.python.logfile import LogFile
Expand All @@ -537,6 +547,8 @@ def createMaster(config):
m = Maker(config)
m.mkdir()
m.chdir()
if config['relocatable']:
config['basedir'] = '.'
contents = masterTAC % config
m.makeTAC(contents)
m.sampleconfig(util.sibpath(__file__, "sample.cfg"))
Expand All @@ -553,6 +565,8 @@ def createMaster(config):
class SlaveOptions(MakerBase):
optFlags = [
["force", "f", "Re-use an existing directory"],
["relocatable", "r",
"Create a relocatable buildbot.tac"],
]
optParameters = [
# ["name", "n", None, "Name for this build slave"],
Expand Down Expand Up @@ -624,6 +638,11 @@ def postOptions(self):
rotateLength = %(log-size)s
maxRotatedFiles = %(log-count)s
# if this is a relocatable tac file, get the directory containing the TAC
if basedir == '.':
import os.path
basedir = os.path.abspath(os.path.dirname(__file__))
application = service.Application('buildslave')
try:
from twisted.python.logfile import LogFile
Expand Down Expand Up @@ -654,6 +673,8 @@ def createSlave(config):
m = Maker(config)
m.mkdir()
m.chdir()
if config['relocatable']:
config['basedir'] = '.'
try:
master = config['master']
host, port = re.search(r'(.+):(\d+)', master).groups()
Expand Down
8 changes: 6 additions & 2 deletions buildbot/status/mail.py
Expand Up @@ -45,6 +45,7 @@ def defaultMessage(mode, name, build, results, master_status):
"""Generate a buildbot mail message and return a tuple of message text
and type."""
result = Results[results]
ss = build.getSourceStamp()

text = ""
if mode == "all":
Expand All @@ -57,7 +58,11 @@ def defaultMessage(mode, name, build, results, master_status):
text += "The Buildbot has detected a restored build"
else:
text += "The Buildbot has detected a new failure"
text += " of %s on %s.\n" % (name, master_status.getProjectName())
if ss and ss.project:
project = ss.project
else:
project = master_status.getProjectName()
text += " on builder %s while building %s.\n" % (name, project)
if master_status.getURLForThing(build):
text += "Full details are available at:\n %s\n" % master_status.getURLForThing(build)
text += "\n"
Expand All @@ -69,7 +74,6 @@ def defaultMessage(mode, name, build, results, master_status):
text += "Build Reason: %s\n" % build.getReason()

source = ""
ss = build.getSourceStamp()
if ss and ss.branch:
source += "[branch %s] " % ss.branch
if ss and ss.revision:
Expand Down
39 changes: 1 addition & 38 deletions buildbot/status/web/authz.py
@@ -1,48 +1,11 @@
from buildbot.status.web.auth import IAuth

# Programming against Authz
#
# There are two times to check authorization in a web app:
# 1. do I advertise the activity (show the form, link, etc.)
# 2. is this request authorized?
#
# The first is accomplished via advertiseAction. In general, this
# is used in a Jinja template:
#
# {{ if authz.advertiseAction('myNewTrick') }}
# <form action="{{ myNewTrick_url }}"> ...
#
# this requires that the template's context include 'authz'. This
# object is available from any HtmlResource subclass as
#
# cxt['authz'] = self.getAuthz(req)
#
# Actions can optionally require authentication, so use needAuthForm
# to determine whether to require a 'username' and 'passwd' field in
# the generated form. These fields are usually generated by the auth()
# form:
#
# {% if authz.needAuthForm('myNewTrick') %}
# {{ auth() }}
# {% endif %}
#
# Once the POST request comes in, it's time to check authorization again.
# This usually looks something like
#
# if not self.getAuthz(req).actionAllowed('myNewTrick', req, someExtraArg):
# return Redirect(path_to_authfail(req))
#
# the someExtraArg is optional (it's handled with *args, so you can have
# several if you want), and is given to the user's authorization function.
# For example, a build-related action should pass the build status, so that
# the user's authorization function could ensure that devs can only operate
# on their own builds.

class Authz(object):
"""Decide who can do what."""

knownActions = [
# If you add a new action here, be sure to also update the documentation
# at docs/cfg-statustargets.texinfo
'gracefulShutdown',
'forceBuild',
'forceAllBuilds',
Expand Down
2 changes: 1 addition & 1 deletion buildbot/status/web/build.py
Expand Up @@ -170,7 +170,7 @@ def rebuild(self, req):
name = req.args.get("username", ["<unknown>"])[0]
comments = req.args.get("comments", ["<no reason specified>"])[0]
reason = ("The web-page 'rebuild' button was pressed by "
"'%s': %s\n" % (html.escape(name), html.escape(comments)))
"'%s': %s\n" % (name, comments))
extraProperties = getAndCheckProperties(req)
if not bc or not b.isFinished() or extraProperties is None:
log.msg("could not rebuild: bc=%s, isFinished=%s"
Expand Down

0 comments on commit a18315b

Please sign in to comment.