extras-buildsys/server PackageJob.py,1.31,1.32 Repo.py,1.16,1.17

Daniel Williams (dcbw) fedora-extras-commits at redhat.com
Tue Oct 25 04:33:38 UTC 2005


Author: dcbw

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

Modified Files:
	PackageJob.py Repo.py 
Log Message:
2005-10-25  Dan Williams  <dcbw at redhat.com>

    * server/PackageJob.py
        - (repo_add_callback): trap failures during repo addition of job

    * server/Repo.py
        - (_update_repo): recognize failures and notify the PackageJob
            of them so the job can fail cleanly rather than half-copying
            stuff to the repo




Index: PackageJob.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/server/PackageJob.py,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- PackageJob.py	14 Sep 2005 18:21:20 -0000	1.31
+++ PackageJob.py	25 Oct 2005 04:33:36 -0000	1.32
@@ -652,8 +652,11 @@
         self.endtime = time.time()
         return True
 
-    def repo_add_callback(self):
-        self._set_cur_stage('repodone')
+    def repo_add_callback(self, success, bad_file=None):
+        if success:
+            self._set_cur_stage('repodone')
+        else:
+            self._stage_failed("Failed to copy %s to the repository directory." % bad_file)
         self.wake()
 
     def _stage_repodone(self):


Index: Repo.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/server/Repo.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- Repo.py	1 Sep 2005 20:36:12 -0000	1.16
+++ Repo.py	25 Oct 2005 04:33:36 -0000	1.17
@@ -88,21 +88,31 @@
     def _update_repo(self):
         """ Copy new RPMS to each repo, and update each repo at the end """
         for buildjob in self._repo_additions:
+            # Ensure all the files are accessible
+            success = True
+            bad_file = None
             for src in buildjob.repofiles.keys():
-                dst = buildjob.repofiles[src]
-                if not os.path.exists(os.path.dirname(dst)):
-                    os.makedirs(os.path.dirname(dst))
-
-                file_in_dst = os.path.join(os.path.dirname(dst), os.path.basename(src))
-                if src.endswith(".src.rpm"):
-                    # Only copy SRPMs to the repo dir if there's not already one there
-                    if not os.path.exists(file_in_dst):
-                        shutil.copy(src, file_in_dst)
-                else:
-                    shutil.copy(src, file_in_dst)
+                if not os.path.exists(src) or not os.access(src, os.R_OK):
+                    success = False
+                    bad_file = src
+
+            if success:
+                for src in buildjob.repofiles.keys():
+                    dst = buildjob.repofiles[src]
+                    if not os.path.exists(os.path.dirname(dst)):
+                        os.makedirs(os.path.dirname(dst))
+
+                    file_in_dst = os.path.join(os.path.dirname(dst), os.path.basename(src))
+
+                    if src.endswith(".src.rpm"):
+                        # Only copy SRPMs to the repo dir if there's not already one there
+                        if not os.path.exists(file_in_dst):
+                            shutil.copy(src, file_in_dst, ignore_errors=True)
+                    else:
+                        shutil.copy(src, file_in_dst, ignore_errors=True)
 
             # Notify the build job that we've copied its files to the repo
-            buildjob.repo_add_callback()
+            buildjob.repo_add_callback(success, bad_file)
 
         self._repo_additions = []
 




More information about the fedora-extras-commits mailing list