extras-buildsys-temp/automation2/client fileserver.py, NONE, 1.1 archwelder.py, 1.4, 1.5 archwelder_config.py, 1.1, 1.2
Daniel Williams (dcbw)
fedora-extras-commits at redhat.com
Sun May 22 05:10:59 UTC 2005
Author: dcbw
Update of /cvs/fedora/extras-buildsys-temp/automation2/client
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv21131/client
Modified Files:
archwelder.py archwelder_config.py
Added Files:
fileserver.py
Log Message:
2005-05-22 Dan Williams <dcbw at redhat.com>
* client/fileserver.py
- Add a simple HTTP server for package download to build server. Its
integration into the archwelder is not yet complete.
--- NEW FILE fileserver.py ---
#!/usr/bin/python -t
# This program 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; either version 2 of the License, or
# (at your option) any later version.
#
# 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 Library 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# copyright 2005 Duke University
# written by Seth Vidal
import SimpleHTTPServer
import SocketServer
import threading
import os
from archwelder_config import CONFIG
BaseRequestHandler = SimpleHTTPServer.SimpleHTTPRequestHandler
BaseHttpServer = SocketServer.TCPServer
class AWHttpRequestHandler(BaseRequestHandler):
def __init__(self, request, client_address, server):
self._server = server
BaseRequestHandler.__init__(self, request, client_address, server)
def list_directory(self):
self.send_error (404, "File not found")
def do_GET(self):
self._server.set_busy (True)
try:
BaseRequestHandler.do_GET(self)
except Exception, e:
# We get an exception if the client drops the transfer
pass
self._server.set_busy (False)
class AWHttpServer(BaseHttpServer):
def __init__(self, server_address, RequestHandlerClass, xmlaw):
os.chdir(CONFIG('built_rpm_download_basedir'))
BaseHttpServer.__init__(self, server_address, RequestHandlerClass)
self.allow_reuse_address = True
# Local variables
self._xmlaw = xmlaw
self._busy = False
def get_xmlaw(self):
return self._xmlaw
def get_busy(self):
return self._busy
def set_busy(self, busy):
self._busy = busy
class HttpServerThread(threading.Thread):
def __init__(self, address_tuple, xmlaw):
self._stop = False
self._xmlaw = xmlaw
self._server = AWHttpServer(address_tuple, AWHttpRequestHandler, xmlaw)
threading.Thread.__init__(self)
def run(self):
self._server.serve_forever()
Index: archwelder.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys-temp/automation2/client/archwelder.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- archwelder.py 12 May 2005 00:42:13 -0000 1.4
+++ archwelder.py 22 May 2005 05:10:57 -0000 1.5
@@ -16,7 +16,6 @@
# written by Seth Vidal
# TODO: xml-rpc communication using 2-way ssl-cert-verified xmlrpc connection
-# TODO: config from file not cli
import SimpleXMLRPCServer
@@ -31,6 +30,7 @@
import string
import time
from archwelder_config import CONFIG
+from fileserver import HttpServerThread
DEBUG = False
def debugprint(stuff=''):
@@ -110,6 +110,9 @@
elif self._status == 'prepping':
self._build()
elif self._status == 'building':
+ # TODO: Should have 'moving' stage
+ # where files are copied to the directory
+ # that fileserver.py looks in.
print "%s: Job done." % self.uniqid
self._status = 'done'
else:
@@ -218,6 +221,8 @@
sum = sha.new()
sum.update(check)
uniqid = sum.hexdigest()
+ if target == 'devel':
+ target = 'development'
awp = getArchWelder(uniqid, srpm, target, stagedir, buildarch, self.localarches)
if awp != None:
self.ids[uniqid] = awp
@@ -291,15 +296,28 @@
localarches = sys.argv[2:]
print "Binding to address '%s' with arches: [%s]" % (hostname, string.join(localarches))
- server = MyXMLRPCServer((hostname, 8888))
+
+ xmlserver = MyXMLRPCServer((hostname, 8888))
aws = XMLRPCArchWelderServer(localarches)
- server.register_instance(aws)
+ xmlserver.register_instance(aws)
+
+ # Start up the HTTP server thread which the build server
+ # pulls completed RPMs from
+ fileserver_thread = HttpServerThread((hostname, 8889), xmlserver)
+ fileserver_thread.start()
+
last_time = time.time()
while True:
- server.handle_request()
+ try:
+ xmlserver.handle_request()
+ except KeyboardInterrupt, e:
+ print "Shutting down..."
+ break
+
cur_time = time.time()
if cur_time >= last_time + 5:
# do some work every 5s or so
aws._process()
last_time = time.time()
+ os._exit(0)
Index: archwelder_config.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys-temp/automation2/client/archwelder_config.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- archwelder_config.py 11 May 2005 19:48:57 -0000 1.1
+++ archwelder_config.py 22 May 2005 05:10:57 -0000 1.2
@@ -3,7 +3,8 @@
config_opts = {}
config_opts['mach_cmd'] = "/usr/bin/mach"
config_opts['distro_name'] = "fedora"
-config_opts['repo_name'] = "extras"
+config_opts['repo_name'] = "core"
+config_opts['built_rpm_download_basedir'] = "/tmp"
def CONFIG (key):
More information about the fedora-extras-commits
mailing list