extras-buildsys/server Builder.py, 1.14, 1.15 PackageJob.py, 1.26, 1.27

Daniel Williams (dcbw) fedora-extras-commits at redhat.com
Tue Aug 30 21:47:23 UTC 2005


Author: dcbw

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

Modified Files:
	Builder.py PackageJob.py 
Log Message:
2005-08-30  Dan Williams <dcbw at redhat.com>

    * builder/builder.py
        - all self.log() -> self._log()

    * server/Builder.py
        - Fix condition where finished jobs wouldn't get noticed
            by the server

    * server/PackageJob.py
        - Fix CVS commands




Index: Builder.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/server/Builder.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Builder.py	29 Aug 2005 17:48:19 -0000	1.14
+++ Builder.py	30 Aug 2005 21:47:21 -0000	1.15
@@ -99,9 +99,16 @@
             alive = False
         return (alive, target_list)
 
+    def _match_target_dict(self, td1, td2):
+        if td1['distro'] == td2['distro']:
+            if td1['target'] == td2['target']:
+                if td1['repo'] == td2['repo']:
+                    return True
+        return False
+
     def arches(self, target_dict):
         for td in self._target_list:
-            if td['distro'] == target_dict['distro'] and td['target'] == target_dict['target'] and td['repo'] == target_dict['repo']:
+            if self._match_target_dict(td, target_dict):
                 arches = []
                 for arch in td['supported_arches']:
                     if not arch in arches:
@@ -111,7 +118,7 @@
 
     def can_build_for_target(self, target_dict):
         for td in self._target_list:
-            if td['distro'] == target_dict['distro'] and td['target'] == target_dict['target'] and td['repo'] == target_dict['repo']:
+            if self._match_target_dict(td, target_dict):
                 if target_dict['arch'] in td['supported_arches']:
                     return True
         return False
@@ -155,6 +162,7 @@
         # Update the current job's status
         if self._unavail_count == 0:
             self._prepping_jobs = False
+            builder_jobs = []
             for jobid in jobs.keys():
                 try:
                     job = self._jobs[jobid]
@@ -162,9 +170,32 @@
                     job.set_builder_job_status(status)
                     if status == 'prepping':
                         self._prepping_jobs = True
+                    builder_jobs.append(jobid)
                 except KeyError:
                     pass
 
+            # We have to check jobs that weren't reported
+            # as 'building' by the builder, since the job
+            # may have finished on the builder and was
+            # removed from the building job list before we
+            # were able to know that it was done.  HACK
+            for jobid in self._jobs.keys():
+                # If the builder didn't report this job as building,
+                # and its not done, explicitly grab its status
+                if jobid not in builder_jobs and self._jobs[jobid] != 'done':
+                    status = self._get_job_status(jobid)
+                    if status:
+                        job.set_builder_job_status(status)
+
+    def get_job_status(self, jobid):
+        """ Get the status of one job on the builder """
+        status = None
+        try:
+            status = self._server.job_status(jobid)
+        except (socket.error, socket.timeout, OpenSSL.SSL.SysCallError, xmlrpclib.ProtocolError):
+            pass
+        return status
+
     def stop(self):
         self._stop = True
 


Index: PackageJob.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/server/PackageJob.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- PackageJob.py	29 Aug 2005 19:28:46 -0000	1.26
+++ PackageJob.py	30 Aug 2005 21:47:21 -0000	1.27
@@ -279,8 +279,8 @@
             env_args = "%s CVS_RSH='%s'" % (env_args, cvs_rsh)
 
         # Checkout the module
-        cmd = 'cd %s; %s co -r %s %s %s' % (self.checkout_tmpdir, CVS_CMD,
-                self._source, self.package, env_args)
+        cmd = 'cd %s; %s %s co -r %s %s' % (self.checkout_tmpdir, env_args, CVS_CMD,
+                self._source, self.package)
         debugprint("%d: Running %s" % (self.uid, cmd))
         s, o = commands.getstatusoutput(cmd)
         if s != 0:
@@ -291,7 +291,7 @@
             # get it from CVS
             pkg_path = os.path.join(self.checkout_tmpdir, self.package)
             if not os.path.exists(os.path.join(pkg_path, "common")):
-                cmd = 'cd %s; %s co common %s' % (pkg_path, CVS_CMD, env_args)
+                cmd = 'cd %s; %s %s co common' % (pkg_path, env_args, CVS_CMD)
                 debugprint("%d: Running %s" % (self.uid, cmd))
                 s, o = commands.getstatusoutput(cmd)
                 if s != 0:




More information about the scm-commits mailing list