1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# Copyright 2009, 2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# Author: Daniel Silverstone <daniel.silverstone@canonical.com>
# Buildd Slave implementation
# XXX: dsilvers: 2005/01/21: Currently everything logged in the slave gets
# passed through to the twistd log too. this could get dangerous/big
from twisted.application import service, strports
from canonical.buildd import XMLRPCBuildDSlave
from canonical.buildd.binarypackage import BinaryPackageBuildManager
from canonical.buildd.sourcepackagerecipe import (
SourcePackageRecipeBuildManager)
from canonical.buildd.translationtemplates import TranslationTemplatesBuildManager
from canonical.launchpad.daemons import tachandler
from twisted.web import server, resource, static
from ConfigParser import SafeConfigParser
import os
conffile = os.environ.get('BUILDD_SLAVE_CONFIG', 'buildd-slave-example.conf')
conf = SafeConfigParser()
conf.read(conffile)
slave = XMLRPCBuildDSlave(conf)
# 'debian' is the old name. It remains here for compatibility.
slave.registerBuilder(BinaryPackageBuildManager, "debian")
slave.registerBuilder(BinaryPackageBuildManager, "binarypackage")
slave.registerBuilder(SourcePackageRecipeBuildManager, "sourcepackagerecipe")
slave.registerBuilder(TranslationTemplatesBuildManager, 'translation-templates')
application = service.Application('BuildDSlave')
builddslaveService = service.IServiceCollection(application)
# Service that announces when the daemon is ready
tachandler.ReadyService().setServiceParent(builddslaveService)
root = resource.Resource()
root.putChild('rpc', slave)
root.putChild('filecache', static.File(conf.get('slave', 'filecache')))
slavesite = server.Site(root)
strports.service(slave.slave._config.get("slave","bindport"),
slavesite).setServiceParent(builddslaveService)
# You can interact with a running slave like this:
# (assuming the slave is on localhost:8221)
#
# python
# import xmlrpclib
# s = xmlrpclib.ServerProxy("http://localhost:8221/rpc")
# s.echo("Hello World")
|