extras-buildsys/builder builder.py,1.8,1.9

Daniel Williams (dcbw) fedora-extras-commits at redhat.com
Fri Jul 8 17:23:46 UTC 2005


Author: dcbw

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

Modified Files:
	builder.py 
Log Message:
2005-07-07  Dan Williams <dcbw at redhat.com>

    * builder/builder.py
        - Clean up the buildroot no matter what

    * Make archjobs write their status to the database too




Index: builder.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/builder/builder.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- builder.py	7 Jul 2005 17:45:02 -0000	1.8
+++ builder.py	8 Jul 2005 17:23:44 -0000	1.9
@@ -79,6 +79,7 @@
         self._srpm_url = srpm_url
         self._log_fd = None
         self._mock_config = None
+        self._done_status = ''
 
         self._result_dir = os.path.join(config_opts['builder_work_dir'], self._uniqid, "result")
         if not os.path.exists(self._result_dir):
@@ -115,7 +116,8 @@
                 self.log("Couldn't kill process %d: %s\n" % (self._pobj.pid, e))
 
         self.log("Killed.\n");
-        self._status = 'killed'
+        self._done_status = 'killed'
+        self._cleanup()
         return True
 
     def log(self, string):
@@ -179,8 +181,8 @@
                 self._status = 'failed'
                 break
 
-            # Kill mock after 5s if it didn't dump the status file
-            if time.time() - start_time > 5:
+            # Kill mock after 7s if it didn't dump the status file
+            if time.time() - start_time > 7:
                 self.log("Timed out waiting for the mock status file!  %s\n" % mockstatusfile)
                 try:
                     self.log("Killing mock...\n")
@@ -294,7 +296,7 @@
         elif self._status == 'failed':
             if self._pobj:
                 exit_status = self._pobj.poll()
-                self.log("Job failed due to mock errors!  mock exit status: %d\n" % exit_status)
+                self.log("Job failed due to mock errors!  Please see output in root.log and build.log\n")
         elif self._status == 'killed':
             self.log("Job failed because it was killed.\n")
 
@@ -329,17 +331,29 @@
                 # mock completed successfully
                 if self._status != 'building':
                     self.log("Bad job end status %s encountered!" % self._status)
+                self._done_status = 'done'
                 self._cleanup()
             elif exit_status > 0:
                 # mock exited with an error
-                self._status = 'failed'
+                self._done_status = 'failed'
+                self._cleanup()
+            else:
+                # mock still running
+                pass
         elif self._status == 'cleanup':
             exit_status = self._pobj.poll()
             if exit_status >= 0:
+                print "mock clean done"
                 # We ignore mock errors when cleaning the buildroot
-                self._status = 'done'
-                if self._mock_config.has_key('rootdir'):
+                self._status = self._done_status
+                # FIXME: remove the last dir off the end of 'rootdir' here to get
+                # the real basedir and kill it.  At least what's here removes the
+                # buildroot which is where most of the space is used
+                if self._mock_config and self._mock_config.has_key('rootdir'):
                     shutil.rmtree(self._mock_config['rootdir'], ignore_errors=True)
+            else:
+                # mock still running
+                pass
 
         self._grab_mock_output()
         if self.is_done_status():




More information about the fedora-extras-commits mailing list