Skip to content

Commit

Permalink
Merge pull request #1478 from sa2ajj/backport-plugins
Browse files Browse the repository at this point in the history
Backport plugins
  • Loading branch information
Mikhail Sobolev committed Jan 17, 2015
2 parents e4b60f6 + da2930e commit 4fcefdd
Show file tree
Hide file tree
Showing 31 changed files with 2,207 additions and 1,098 deletions.
5 changes: 4 additions & 1 deletion Makefile
Expand Up @@ -19,9 +19,12 @@ pyflakes:
pep8:
pep8 --config=common/pep8rc master slave

# XXX(sa2ajj): make it a non-phony target
# TODO(sa2ajj): make it a non-phony target
artifacts: DEST_DIR := $(CURDIR)/dist
artifacts:
@rm -rf $(DEST_DIR)
@mkdir -p $(DEST_DIR)
@for name in master slave; do (rm -f $$name/MANIFEST; cd $$name; python setup.py sdist --formats gztar,zip -d $(DEST_DIR)); done

rmpyc:
find . \( -name '*.pyc' -o -name '*.pyo' \) -exec rm -v {} \;
2 changes: 2 additions & 0 deletions master/Makefile
Expand Up @@ -5,3 +5,5 @@ tutorial:
cd docs/tutorial; $(MAKE) html
pyflakes:
pyflakes buildbot
rmpyc:
make -C .. rmpyc
20 changes: 20 additions & 0 deletions master/buildbot/errors.py
@@ -0,0 +1,20 @@
# This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright Buildbot Team Members

# Having them here prevents all kind of circular dependencies


class PluginDBError(Exception):
pass
21 changes: 17 additions & 4 deletions master/buildbot/interfaces.py
Expand Up @@ -44,7 +44,13 @@ class LatentBuildSlaveFailedToSubstantiate(Exception):
pass


class IChangeSource(Interface):
class IPlugin(Interface):
"""
Base interface for all Buildbot plugins
"""


class IChangeSource(IPlugin):

"""
Service which feeds Change objects to the changemaster. When files or
Expand Down Expand Up @@ -883,7 +889,7 @@ def finish():
"""The log has finished sending chunks to the consumer."""


class IStatusReceiver(Interface):
class IStatusReceiver(IPlugin):

"""I am an object which can receive build status updates. I may be
subscribed to an IStatus, an IBuilderStatus, or an IBuildStatus."""
Expand Down Expand Up @@ -1141,7 +1147,7 @@ def logChunk(build, step, log, channel, text):
pass


class IBuildSlave(Interface):
class IBuildSlave(IPlugin):
# this is a marker interface for the BuildSlave class
pass

Expand Down Expand Up @@ -1266,7 +1272,7 @@ def render(value):
"""


class IScheduler(Interface):
class IScheduler(IPlugin):
pass


Expand All @@ -1285,3 +1291,10 @@ class IBuildStepFactory(Interface):

def buildStep():
pass


class IBuildStep(IPlugin):
"""
A build step
"""
# Currently has nothing
38 changes: 38 additions & 0 deletions master/buildbot/plugins/__init__.py
@@ -0,0 +1,38 @@
# This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright Buildbot Team Members

"""
Buildbot plugin infrastructure
"""

from buildbot.plugins.db import get_plugins
from buildbot.interfaces import IBuildSlave
from buildbot.interfaces import IBuildStep
from buildbot.interfaces import IChangeSource
from buildbot.interfaces import IScheduler
from buildbot.interfaces import IStatusReceiver


__all__ = ['changes', 'schedulers', 'buildslave', 'steps', 'status', 'util']


# Names here match the names of the corresponding Buildbot module, hence
# 'changes', 'schedulers', but 'buildslave'
changes = get_plugins('changes', IChangeSource)
schedulers = get_plugins('schedulers', IScheduler)
buildslave = get_plugins('buildslave', IBuildSlave)
steps = get_plugins('steps', IBuildStep)
status = get_plugins('status', IStatusReceiver)
util = get_plugins('util', None)

0 comments on commit 4fcefdd

Please sign in to comment.