1
# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
4
# CAUTION: The only modules in the Launchpad tree that this is permitted to
5
# depend on are canonical.buildd, since buildds are deployed by copying that
6
# directory only. (See also bug=800295.)
8
# Buildd Slave implementation
9
# XXX: dsilvers: 2005/01/21: Currently everything logged in the slave gets
10
# passed through to the twistd log too. this could get dangerous/big
12
from twisted.application import service, strports
13
from canonical.buildd import XMLRPCBuildDSlave
14
from canonical.buildd.binarypackage import BinaryPackageBuildManager
15
from canonical.buildd.sourcepackagerecipe import (
16
SourcePackageRecipeBuildManager)
17
from canonical.buildd.translationtemplates import (
18
TranslationTemplatesBuildManager)
20
from twisted.web import server, resource, static
21
from ConfigParser import SafeConfigParser
25
conffile = os.environ.get('BUILDD_SLAVE_CONFIG', 'buildd-slave-example.conf')
27
conf = SafeConfigParser()
29
slave = XMLRPCBuildDSlave(conf)
31
# 'debian' is the old name. It remains here for compatibility.
32
slave.registerBuilder(BinaryPackageBuildManager, "debian")
33
slave.registerBuilder(BinaryPackageBuildManager, "binarypackage")
34
slave.registerBuilder(SourcePackageRecipeBuildManager, "sourcepackagerecipe")
35
slave.registerBuilder(
36
TranslationTemplatesBuildManager, 'translation-templates')
38
application = service.Application('BuildDSlave')
39
builddslaveService = service.IServiceCollection(application)
41
root = resource.Resource()
42
root.putChild('rpc', slave)
43
root.putChild('filecache', static.File(conf.get('slave', 'filecache')))
44
slavesite = server.Site(root)
46
strports.service(slave.slave._config.get("slave","bindport"),
47
slavesite).setServiceParent(builddslaveService)
49
# You can interact with a running slave like this:
50
# (assuming the slave is on localhost:8221)
54
# s = xmlrpclib.ServerProxy("http://localhost:8221/rpc")
55
# s.echo("Hello World")