extras-buildsys/builder CONFIG.py,1.2,1.3 builder.py,1.3,1.4
Daniel Williams (dcbw)
fedora-extras-commits at redhat.com
Fri Jul 1 11:51:29 UTC 2005
Author: dcbw
Update of /cvs/fedora/extras-buildsys/builder
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv11305/builder
Modified Files:
CONFIG.py builder.py
Log Message:
2005-07-01 Dan Williams <dcbw at redhat.com>
* We now use lighttpd as the fileserver in both the server and the builder. It's
a lot more robust than the python implementation, but the python implementation
code still exists and can be used.
* The server key and certificate must now be in the same file. You can 'cat' them
together with 'cat key.pem cert.pem > key_and_cert.pem'
* Initialize m2crypto threading in buildservery.py and builder.py
* Change some config options for the builder that said 'client' to 'builder'
* Add some testing code to SimpleHTTPSServer.py and FileDownloader.py
Index: CONFIG.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/builder/CONFIG.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CONFIG.py 28 Jun 2005 02:03:12 -0000 1.2
+++ CONFIG.py 1 Jul 2005 11:51:27 -0000 1.3
@@ -1,4 +1,4 @@
-# Configuration file for archwelder.py
+# Configuration file for plague builder
config_opts = {}
config_opts['debug'] = True
@@ -7,7 +7,7 @@
# Distro and Repo:
#
-# The build client constructs the buildroot name that it
+# The builder constructs the buildroot name that it
# passes to mock from a few things. The format is:
#
# <distro_name>-<target>-<arch>-<repo_name>
@@ -26,12 +26,11 @@
# SSL Certs and keys
# MUST be full path to cert
-config_opts['client_cert'] = BUILDER_DIR + "/certs/client_cert.pem"
-config_opts['client_key'] = BUILDER_DIR + "/certs/client_key.pem"
+config_opts['builder_key_and_cert'] = BUILDER_DIR + "/certs/builder_key_and_cert.pem"
config_opts['ca_cert'] = BUILDER_DIR + "/certs/ca_cert.pem"
# Where to keep SRPMs to build and the finished products
# and logs.
# WARNING: this directory is world-readable via HTTP!
-config_opts['client_work_dir'] = "/tmp/build_client_work"
+config_opts['builder_work_dir'] = "/tmp/builder_work"
Index: builder.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/builder/builder.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- builder.py 29 Jun 2005 05:22:54 -0000 1.3
+++ builder.py 1 Jul 2005 11:51:27 -0000 1.4
@@ -15,8 +15,6 @@
# copyright 2005 Duke University
# written by Seth Vidal
-# TODO: xml-rpc communication using 2-way ssl-cert-verified xmlrpc connection
-
import SimpleXMLRPCServer
import xmlrpclib
@@ -32,19 +30,21 @@
import fcntl
import urllib
import errno
-from plague import SimpleHTTPSServer
from plague import FileDownloader
from plague import SimpleSSLXMLRPCServer
+from plague import lighttpdManager
+from plague import SimpleHTTPSServer
+from M2Crypto import threading as m2thread
# Load in the config
execfile("/etc/plague/builder/CONFIG.py")
+use_lighttpd = True
g_our_hostname = None
certs = {}
-certs['cert'] = config_opts['client_cert']
-certs['key'] = config_opts['client_key']
+certs['key_and_cert'] = config_opts['builder_key_and_cert']
certs['ca_cert'] = config_opts['ca_cert']
certs['peer_ca_cert'] = config_opts['ca_cert']
@@ -52,10 +52,10 @@
def get_url_for_file(file_path):
""" Return a URL pointing to a particular file in our work dir """
- # Ensure the file we're turning into a URL lives in our client work dir
- if not file_path.startswith(config_opts["client_work_dir"]):
+ # Ensure the file we're turning into a URL lives in our builder work dir
+ if not file_path.startswith(config_opts["builder_work_dir"]):
return None
- file_part = file_path[len(config_opts["client_work_dir"]) + 1:]
+ file_part = file_path[len(config_opts["builder_work_dir"]) + 1:]
port = "%s" % config_opts['fileserver_port']
full_url = "https://" + g_our_hostname + ":" + port + "/" + file_part
return urllib.quote(full_url)
@@ -77,15 +77,15 @@
self._log_fd = None
self._mock_config = None
- self._result_dir = os.path.join(config_opts['client_work_dir'], self._uniqid, "result")
+ self._result_dir = os.path.join(config_opts['builder_work_dir'], self._uniqid, "result")
if not os.path.exists(self._result_dir):
os.makedirs(self._result_dir)
- self._state_dir = os.path.join(config_opts['client_work_dir'], self._uniqid, "mock-state")
+ self._state_dir = os.path.join(config_opts['builder_work_dir'], self._uniqid, "mock-state")
if not os.path.exists(self._state_dir):
os.makedirs(self._state_dir)
- logfile = os.path.join(self._result_dir, "buildclient.log")
+ logfile = os.path.join(self._result_dir, "builder.log")
self._log_fd = open(logfile, "w+")
self.log("""Starting job:
@@ -101,7 +101,7 @@
self._srpm_path = None
self.log("Failed in __init__, couldn't extract SRPM filename.\n")
else:
- self._srpm_path = os.path.join(config_opts['client_work_dir'], self._uniqid, "source", srpm_filename)
+ self._srpm_path = os.path.join(config_opts['builder_work_dir'], self._uniqid, "source", srpm_filename)
def die(self, sig=15):
if self._pobj and self._pobj.pid: # Can't kill the package download from build server
@@ -433,7 +433,7 @@
}
def getBuildClient(uniqid, target, buildarch, srpm_url, localarches):
- """hand it an arch it hands you back the build client instance you need"""
+ """hand it an arch it hands you back the builder instance you need"""
if not builder_dict.has_key(buildarch):
# raise an exception here bitching about no place to build for that arch
@@ -554,6 +554,8 @@
print "Binding to address '%s' with arches: [%s]" % (g_our_hostname, string.join(localarches))
+ m2thread.init()
+
xmlrpc_port = config_opts['xmlrpc_port']
xmlserver = SimpleSSLXMLRPCServer.SimpleSSLXMLRPCServer(certs, (g_our_hostname, xmlrpc_port))
bcs = XMLRPCBuildClientServer(localarches)
@@ -561,9 +563,13 @@
# Start up the HTTP server thread which the build server
# pulls completed RPMs from
- work_dir = config_opts['client_work_dir']
- fs_port = config_opts['fileserver_port']
- http_server = SimpleHTTPSServer.SimpleHTTPSServer(certs, (g_our_hostname, fs_port), work_dir)
+ work_dir = config_opts['builder_work_dir']
+ port = config_opts['fileserver_port']
+ if use_lighttpd:
+ http_cnf_file = "/var/tmp/plague-builder-%s.conf" % os.getpid()
+ http_server = lighttpdManager.lighttpdManager(http_cnf_file, g_our_hostname, port, work_dir, config_opts['builder_key_and_cert'])
+ else:
+ http_server = SimpleHTTPSServer.SimpleHTTPSServer(certs, (g_our_hostname, port), work_dir)
http_server.start()
last_time = time.time()
@@ -587,4 +593,7 @@
bcs.process()
last_time = time.time()
+ http_server.stop()
+ time.sleep(2)
+ m2thread.cleanup()
os._exit(0)
More information about the fedora-extras-commits
mailing list