summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2010-03-01 01:13:11 -0500
committerColin Walters <walters@verbum.org>2010-03-01 01:13:11 -0500
commit7c34c8f30b33c48e94518baac72409a12d228a11 (patch)
tree7b6dfea333e605dbddb24571ad5b4f878873856f
parentb48aa7a9725c459d9eab46d514ecc4a39b4f7f40 (diff)
downloadfedpkg-make-pull-7c34c8f30b33c48e94518baac72409a12d228a11.tar.gz
fedpkg-make-pull-7c34c8f30b33c48e94518baac72409a12d228a11.tar.xz
fedpkg-make-pull-7c34c8f30b33c48e94518baac72409a12d228a11.zip
[qabox] New directory with skeleton for running autobuilder and IRC bot
-rwxr-xr-xqabox/supervisor-session6
-rw-r--r--qabox/supervisor.conf24
-rw-r--r--qabox/supybot/Fedpkg/README.txt2
-rw-r--r--qabox/supybot/Fedpkg/__init__.py42
-rw-r--r--qabox/supybot/Fedpkg/config.py27
-rw-r--r--qabox/supybot/Fedpkg/local/__init__.py1
-rw-r--r--qabox/supybot/Fedpkg/plugin.py71
-rw-r--r--qabox/supybot/Fedpkg/test.py14
8 files changed, 187 insertions, 0 deletions
diff --git a/qabox/supervisor-session b/qabox/supervisor-session
new file mode 100755
index 0000000..9c7bd38
--- /dev/null
+++ b/qabox/supervisor-session
@@ -0,0 +1,6 @@
+#!/usr/bin/python
+
+import os
+import sys
+
+os.execvp('dbus-launch', ['dbus-launch', 'supervisord', '-c'] + sys.argv[1:])
diff --git a/qabox/supervisor.conf b/qabox/supervisor.conf
new file mode 100644
index 0000000..73342f6
--- /dev/null
+++ b/qabox/supervisor.conf
@@ -0,0 +1,24 @@
+[supervisord]
+http_port=supervisor.sock
+logfile=logs/supervisord.log
+logfile_maxbytes=50MB
+logfile_backups=10
+loglevel=info
+nodaemon=true
+
+[supervisorctl]
+serverurl=unix://supervisor.sock
+
+[program:fedpkg-autobuilder]
+command=/bin/sh -c 'cd build && exec fedpkg-autobuilder --conf=autobuild.conf'
+log_stderr=true
+logfile=logs/supybot.log
+logfile_maxbytes=10MB
+logfile_backups=2
+
+[program:supybot]
+command=/bin/sh -c 'cd supybot && exec supybot ../supybot.conf'
+log_stderr=true
+logfile=logs/supybot.log
+logfile_maxbytes=10MB
+logfile_backups=2
diff --git a/qabox/supybot/Fedpkg/README.txt b/qabox/supybot/Fedpkg/README.txt
new file mode 100644
index 0000000..21b362f
--- /dev/null
+++ b/qabox/supybot/Fedpkg/README.txt
@@ -0,0 +1,2 @@
+IRC bot notifying of status changes in the build.
+
diff --git a/qabox/supybot/Fedpkg/__init__.py b/qabox/supybot/Fedpkg/__init__.py
new file mode 100644
index 0000000..d90971a
--- /dev/null
+++ b/qabox/supybot/Fedpkg/__init__.py
@@ -0,0 +1,42 @@
+###
+# Licensed under the new-BSD license (http://www.opensource.org/licenses/bsd-license.php)
+# Copyright (C) 2010 Red Hat, Inc.
+# Written by Colin Walters <walters@verbum.org>
+#
+###
+
+"""
+Notify of build status changes from fedpkg-pull-build-chain.
+"""
+
+import supybot
+import supybot.world as world
+
+# Use this for the version of this plugin. You may wish to put a CVS keyword
+# in here if you're keeping the plugin in CVS or some similar system.
+__version__ = ""
+
+# XXX Replace this with an appropriate author or supybot.Author instance.
+__author__ = supybot.authors.unknown
+
+# This is a dictionary mapping supybot.Author instances to lists of
+# contributions.
+__contributors__ = {}
+
+# This is a url where the most recent plugin package can be downloaded.
+__url__ = '' # 'http://supybot.com/Members/yourname/FedpkgPullBuildChain/download'
+
+import config
+import plugin
+reload(plugin) # In case we're being reloaded.
+# Add more reloads here if you add third-party modules and want them to be
+# reloaded when this plugin is reloaded. Don't forget to import them as well!
+
+if world.testing:
+ import test
+
+Class = plugin.Class
+configure = config.configure
+
+
+# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
diff --git a/qabox/supybot/Fedpkg/config.py b/qabox/supybot/Fedpkg/config.py
new file mode 100644
index 0000000..a87d159
--- /dev/null
+++ b/qabox/supybot/Fedpkg/config.py
@@ -0,0 +1,27 @@
+###
+# Licensed under the new-BSD license (http://www.opensource.org/licenses/bsd-license.php)
+# Copyright (C) 2010 Red Hat, Inc.
+# Written by Colin Walters <walters@verbum.org>
+#
+#
+###
+
+import supybot.conf as conf
+import supybot.registry as registry
+
+def configure(advanced):
+ # This will be called by supybot to configure this module. advanced is
+ # a bool that specifies whether the user identified himself as an advanced
+ # user or not. You should effect your configuration by manipulating the
+ # registry as appropriate.
+ from supybot.questions import expect, anything, something, yn
+ conf.registerPlugin('Fedpkg', True)
+
+
+Fedpkg = conf.registerPlugin('Fedpkg')
+
+conf.registerGlobalValue(Fedpkg, 'builddir',
+ registry.String('', """Build directory."""))
+
+
+# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
diff --git a/qabox/supybot/Fedpkg/local/__init__.py b/qabox/supybot/Fedpkg/local/__init__.py
new file mode 100644
index 0000000..e86e97b
--- /dev/null
+++ b/qabox/supybot/Fedpkg/local/__init__.py
@@ -0,0 +1 @@
+# Stub so local is a module, used for third-party modules
diff --git a/qabox/supybot/Fedpkg/plugin.py b/qabox/supybot/Fedpkg/plugin.py
new file mode 100644
index 0000000..3cf09fa
--- /dev/null
+++ b/qabox/supybot/Fedpkg/plugin.py
@@ -0,0 +1,71 @@
+###
+# Licensed under the new-BSD license (http://www.opensource.org/licenses/bsd-license.php)
+# Copyright (C) 2010 Red Hat, Inc.
+# Written by Colin Walters <walters@verbum.org>
+#
+###
+
+import supybot.conf as conf
+import supybot.utils as utils
+from supybot.commands import *
+import supybot.plugins as plugins
+import supybot.ircutils as ircutils
+import supybot.callbacks as callbacks
+
+import dbus
+from dbus.mainloop.glib import DBusGMainLoop
+DBusGMainLoop(set_as_default=True)
+
+AUTOBUILD_SERVICE = 'org.fedoraproject.FedpkgAutoBuilder'
+AUTOBUILD_OBJPATH = '/org/fedoraproject/FedpkgAutoBuilder'
+
+class Fedpkg(callbacks.Plugin):
+ """Add the help for "@plugin help Fedpkg" here
+ This should describe *how* to use this plugin."""
+ def __init__(self, irc):
+ callbacks.Plugin.__init__(self, irc)
+ self.__irc = irc
+ self._builddir = conf.supybot.plugins.Fedpkg.builddir()
+
+ bus = dbus.SessionBus()
+ self._bus_proxy = dbus.Interface(bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus'),
+ 'org.freedesktop.DBus')
+ self._bus_proxy.connect_to_signal('NameOwnerChanged', self.__on_name_owner_changed)
+ try:
+ self.__reload_proxy()
+ except:
+ self._autobuild_proxy = None
+
+ def __on_name_owner_changed(self, name, prev_owner, new_owner):
+ if name != AUTOBUILD_SERVICE:
+ return
+ if new_owner == '':
+ del self._autobuild_proxy
+ self._autobuild_proxy = None
+ return
+ self.__reload_proxy()
+
+ def __reload_proxy(self):
+ bus = dbus.SessionBus()
+ proxy = bus.get_object(AUTOBUILD_SERVICE, AUTOBUILD_OBJPATH)
+ self._autobuild_proxy = dbus.Interface(proxy, AUTOBUILD_SERVICE)
+ self._modules = self._autobuild_proxy.GetModules()
+ self._autobuild_proxy.connect_to_signal('StateChanged', self.__on_builder_state_changed)
+
+ def status(self, irc, msg, args):
+ if self._autobuild_proxy is None:
+ irc.reply(AUTOBUILD_SERVICE + ' is not running')
+ return
+ status = self._autobuild_proxy.GetStatus()
+ (state, statedata) = self._autobuild_proxy.GetState()
+ irc.reply("[%s] build of %s is currently %s (%r)" % (status, self._modules[-1], state, statedata))
+
+ def __on_builder_state_changed(self, state, statedata):
+ for channel in self.__irc.state.channels:
+ self.__irc.reply("build of %s has changed state to %s (%r)", self._modules[1], state, statedata)
+
+
+Class = Fedpkg
+
+
+# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
diff --git a/qabox/supybot/Fedpkg/test.py b/qabox/supybot/Fedpkg/test.py
new file mode 100644
index 0000000..a16a88a
--- /dev/null
+++ b/qabox/supybot/Fedpkg/test.py
@@ -0,0 +1,14 @@
+###
+# Copyright (c) 2010, Colin Walters
+# All rights reserved.
+#
+#
+###
+
+from supybot.test import *
+
+class FedpkgTestCase(PluginTestCase):
+ plugins = ('Fedpkg',)
+
+
+# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: