extras-buildsys/builder builder.py,1.43,1.44

Daniel Williams (dcbw) fedora-extras-commits at redhat.com
Wed Oct 5 17:44:01 UTC 2005


Author: dcbw

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

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

    * builder/builder.py
        - Fix race condition in which files would not be downloaded
            to the build server




Index: builder.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/builder/builder.py,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- builder.py	16 Sep 2005 18:11:14 -0000	1.43
+++ builder.py	5 Oct 2005 17:43:59 -0000	1.44
@@ -370,7 +370,6 @@
         if aux_pid:
             self._childpid = 0
             # Mock exited
-            self._status = self._done_status
             if self._mock_config:
                 if self._mock_config.has_key('rootdir'):
                     mock_root_dir = os.path.abspath(os.path.join(self._mock_config['rootdir'], "../"))
@@ -386,11 +385,10 @@
                 if source_dir.endswith(os.path.join(self._uniqid, "source")):
                     shutil.rmtree(source_dir, ignore_errors=True)
 
-    def _job_done(self):
         # Ensure child process is reaped, if any
         if self._childpid:
             try:
-                self._log("Waiting for child process %d to exit." % self._childpid)
+                self._log("Waiting for child process %d to exit.\n" % self._childpid)
                 (pid, status) = os.waitpid(self._childpid, 0)
             except OSError, e:
                 self._childpid = 0
@@ -399,13 +397,17 @@
         self._copy_mock_output_to_log()
 
         self._files = self._find_files()
-        self._log("\n\n-----------------------\n\n")
+        self._status = self._done_status
+
+    def _job_done(self):
+        self._log("-----------------------\n")
         if self._status == 'done':
             self._log("Job completed successfully.\n")
         elif self._status == 'failed':
             self._log("Job failed due to build errors!  Please see build logs.\n")
         elif self._status == 'killed':
             self._log("Job failed because it was killed.\n")
+        self._log("\n\n")
 
         if self._log_fd:
             self._log_fd.close()
@@ -426,7 +428,7 @@
             srpm_filename = FileDownloader.get_base_filename_from_url(self._srpm_url, ['.src.rpm'])
             self._srpm_path = os.path.join(work_dir, self._uniqid, "source", srpm_filename)
         except FileDownloader.FileNameException, e:
-            self._log("ERROR: SRPM file name was invalid.  Message: '%s'" % e)
+            self._log("ERROR: SRPM file name was invalid.  Message: '%s'\n" % e)
             self._status = 'failed'
 
         # Main build job work loop
@@ -440,7 +442,7 @@
                 func()
                 time.sleep(3)
             except AttributeError:
-                self._log("ERROR: internal builder inconsistency, didn't recognize status '%s'." % self._status)
+                self._log("ERROR: internal builder inconsistency, didn't recognize status '%s'.\n" % self._status)
                 self._status = 'failed'
 
         self._job_done()
@@ -453,14 +455,16 @@
         # Grab the list of files in our job's result dir and URL encode them
         files_in_dir = os.listdir(self._result_dir)
         file_list = []
-        self._log("\n\nOutput File List:\n-----------------\n")
+        self._log("\n")
+        self._log("Output File List:\n")
+        self._log("-----------------\n")
         for f in files_in_dir:
             file_url = get_url_for_file(self._builder_cfg, os.path.join(self._result_dir, f))
             if file_url:
                 file_list.append(file_url)
                 self._log("  Output File: %s\n" % urllib.unquote(file_url))
             else:
-                self._log("  Error: Couldn't get file URL for file %s" % f)
+                self._log("  Error: Couldn't get file URL for file %s\n" % f)
         self._log("-----------------\n")
         return file_list
 




More information about the fedora-extras-commits mailing list