[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

extras-buildsys/client Makefile, NONE, 1.1 buildclient.py, 1.17, 1.18 build-client, 1.1, NONE



Author: dcbw

Update of /cvs/fedora/extras-buildsys/client
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv6600/client

Modified Files:
	buildclient.py 
Added Files:
	Makefile 
Removed Files:
	build-client 
Log Message:
2005-06-25  Dan Williams <dcbw redhat com>

    * We have a name: "(The) Plague".  We come to eat your packages.

    * Add Makefiles, install common stuff in python site-packages,
        and convert files to use config from /etc




--- NEW FILE Makefile ---
BINDIR=/usr/bin
ETCDIR=/etc
DESTDIR=''
INSTALL=/usr/bin/install
MKDIR=/bin/mkdir

clean:
	rm -f *.pyc *.pyo *~ *.bak

INSTDIR=$(DESTDIR)/$(BINDIR)/$(PKGNAME)/client
CONFIGDIR=$(DESTDIR)/$(ETCDIR)/$(PKGNAME)/client

install:
	$(MKDIR) -p $(INSTDIR)
	$(INSTALL) -m 755 buildclient.py $(INSTDIR)/$(PKGNAME)-client
	$(MKDIR) -p $(CONFIGDIR)
	$(INSTALL) -m 755 CONFIG.py $(CONFIGDIR)/CONFIG.py


Index: buildclient.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/client/buildclient.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- buildclient.py	25 Jun 2005 19:19:04 -0000	1.17
+++ buildclient.py	26 Jun 2005 14:52:24 -0000	1.18
@@ -32,27 +32,31 @@
 import fcntl
 import urllib
 import errno
-import CONFIG
-import SimpleHTTPSServer
-import FileDownloader
-import SimpleSSLXMLRPCServer
+from plague import SimpleHTTPSServer
+from plague import FileDownloader
+from plague import SimpleSSLXMLRPCServer
+
+
+# Load in the config
+execfile("/etc/plague/client/CONFIG.py")
+
 
 g_our_hostname = None
 certs = {}
-certs['cert'] = CONFIG.get('client_cert')
-certs['key'] = CONFIG.get('client_key')
-certs['ca_cert'] = CONFIG.get('ca_cert')
-certs['peer_ca_cert'] = CONFIG.get('ca_cert')
+certs['cert'] = config_opts['client_cert']
+certs['key'] = config_opts['client_key']
+certs['ca_cert'] = config_opts['ca_cert']
+certs['peer_ca_cert'] = config_opts['ca_cert']
 
 
 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.get("client_work_dir")):
+    if not file_path.startswith(config_opts["client_work_dir"]):
         return None
-    file_part = file_path[len(CONFIG.get("client_work_dir")) + 1:]
-    port = "%s" % CONFIG.get('fileserver_port')
+    file_part = file_path[len(config_opts["client_work_dir"]) + 1:]
+    port = "%s" % config_opts['fileserver_port']
     full_url = "https://"; + g_our_hostname + ":" + port + "/" + file_part
     return urllib.quote(full_url)
 
@@ -73,11 +77,11 @@
         self._log_fd = None
         self._mock_config = None
 
-        self._result_dir = os.path.join(CONFIG.get('client_work_dir'), self._uniqid, "result")
+        self._result_dir = os.path.join(config_opts['client_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.get('client_work_dir'), self._uniqid, "mock-state")
+        self._state_dir = os.path.join(config_opts['client_work_dir'], self._uniqid, "mock-state")
         if not os.path.exists(self._state_dir):
             os.makedirs(self._state_dir)
 
@@ -97,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.get('client_work_dir'), self._uniqid, "source", srpm_filename)
+            self._srpm_path = os.path.join(config_opts['client_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
@@ -116,7 +120,7 @@
             self._log_fd.write(string)
             self._log_fd.flush()
             os.fsync(self._log_fd.fileno())
-            if CONFIG.get('debug'):
+            if config_opts['debug']:
                 s = "%s: " % self._uniqid
                 sys.stdout.write(s + string)
                 sys.stdout.flush()
@@ -152,7 +156,7 @@
         if not os.path.exists(self._result_dir):
             os.makedirs(self._result_dir)
         cmd = '%s %s -r %s --resultdir=%s --statedir=%s --uniqueext=%s %s' % (self.arch_command,
-                            CONFIG.get('builder_cmd'), self.buildroot, 
+                            config_opts['builder_cmd'], self.buildroot, 
                             self._result_dir, self._state_dir, self._uniqid, self._srpm_path)
         self.log("   %s\n" % cmd)
         self._pobj = popen2.Popen4(cmd=cmd, bufsize=1024)
@@ -188,7 +192,7 @@
     def _cleanup(self):
         self.log("Cleaning up the buildroot...\n")
         cmd = '%s %s clean --uniqueext=%s -r %s' % (self.arch_command,
-                            CONFIG.get('builder_cmd'), self._uniqid,
+                            config_opts['builder_cmd'], self._uniqid,
                             self.buildroot)
         self.log("   %s\n" % cmd)
         self._pobj = popen2.Popen4(cmd=cmd)
@@ -369,42 +373,42 @@
 
 class i386Arch(BuildClientMock):
     def __init__(self, uniqid, target, buildarch, srpm_url):
-        self.buildroot = '%s-%s-i386-%s' % (CONFIG.get('distro_name'), target, CONFIG.get('repo_name'))
+        self.buildroot = '%s-%s-i386-%s' % (config_opts['distro_name'], target, config_opts['repo_name'])
         self.buildarch = buildarch
         self.arch_command = '/usr/bin/setarch i686'
         BuildClientMock.__init__(self, uniqid, target, srpm_url)
 
 class x86_64Arch(BuildClientMock):
     def __init__(self, uniqid, target, buildarch, srpm_url):
-        self.buildroot = '%s-%s-x86_64-%s' % (CONFIG.get('distro_name'), target, CONFIG.get('repo_name'))
+        self.buildroot = '%s-%s-x86_64-%s' % (config_opts['distro_name'], target, config_opts['repo_name'])
         self.buildarch = buildarch
         self.arch_command = ''
         BuildClientMock.__init__(self, uniqid, target, srpm_url)
 
 class PPCArch(BuildClientMock):
     def __init__(self, uniqid, target, buildarch, srpm_url):
-        self.buildroot = '%s-%s-ppc-%s' % (CONFIG.get('distro_name'), target, CONFIG.get('repo_name'))
+        self.buildroot = '%s-%s-ppc-%s' % (config_opts['distro_name'], target, config_opts['repo_name'])
         self.buildarch = buildarch
         self.arch_command = ''
         BuildClientMock.__init__(self, uniqid, target, srpm_url)
 
 class PPC64Arch(BuildClientMock):
     def __init__(self, uniqid, target, buildarch, srpm_url):
-        self.buildroot = '%s-%s-ppc64-%s' % (CONFIG.get('distro_name'), target, CONFIG.get('repo_name'))
+        self.buildroot = '%s-%s-ppc64-%s' % (config_opts['distro_name'], target, config_opts['repo_name'])
         self.buildarch = buildarch
         self.arch_command = ''
         BuildClientMock.__init__(self, uniqid, target, srpm_url)
 
 class SparcArch(BuildClientMock):
     def __init__(self, uniqid, target, buildarch, srpm_url):
-        self.buildroot = '%s-%s-sparc-%s' % (CONFIG.get('distro_name'), target, CONFIG.get('repo_name'))
+        self.buildroot = '%s-%s-sparc-%s' % (config_opts['distro_name'], target, config_opts['repo_name'])
         self.buildarch = buildarch
         self.arch_command = '/usr/bin/sparc32'
         BuildClientMock.__init__(self, uniqid, target, srpm_url)
 
 class Sparc64Arch(BuildClientMock):
     def __init__(self, uniqid, target, buildarch, srpm_url):
-        self.buildroot = '%s-%s-sparc64-%s' % (CONFIG.get('distro_name'), target, CONFIG.get('repo_name'))
+        self.buildroot = '%s-%s-sparc64-%s' % (config_opts['distro_name'], target, config_opts['repo_name'])
         self.buildarch = buildarch
         self.arch_command = '/usr/bin/sparc64'
         BuildClientMock.__init__(self, uniqid, target, srpm_url)
@@ -446,7 +450,7 @@
 
 
 def log(string):
-    if CONFIG.get('debug'):
+    if config_opts['debug']:
         print string
 
 class XMLRPCBuildClientServer:
@@ -549,15 +553,15 @@
 
     print "Binding to address '%s' with arches: [%s]" % (g_our_hostname, string.join(localarches))
 
-    xmlrpc_port = CONFIG.get('xmlrpc_port')
+    xmlrpc_port = config_opts['xmlrpc_port']
     xmlserver = SimpleSSLXMLRPCServer.SimpleSSLXMLRPCServer(certs, (g_our_hostname, xmlrpc_port))
     bcs = XMLRPCBuildClientServer(localarches)
     xmlserver.register_instance(bcs)
 
     # Start up the HTTP server thread which the build server
     # pulls completed RPMs from
-    work_dir = CONFIG.get('client_work_dir')
-    fs_port = CONFIG.get('fileserver_port')
+    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)
     http_server.start()
 


--- build-client DELETED ---


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]