pld-builder.new: PLD_Builder/rpm_builder.py - more weird cases to handle

arekm arekm at pld-linux.org
Wed Jul 15 14:22:07 CEST 2009


Author: arekm                        Date: Wed Jul 15 12:22:07 2009 GMT
Module: pld-builder.new               Tag: HEAD
---- Log message:
- more weird cases to handle

---- Files affected:
pld-builder.new/PLD_Builder:
   rpm_builder.py (1.83 -> 1.84) 

---- Diffs:

================================================================
Index: pld-builder.new/PLD_Builder/rpm_builder.py
diff -u pld-builder.new/PLD_Builder/rpm_builder.py:1.83 pld-builder.new/PLD_Builder/rpm_builder.py:1.84
--- pld-builder.new/PLD_Builder/rpm_builder.py:1.83	Wed Jul 15 14:09:44 2009
+++ pld-builder.new/PLD_Builder/rpm_builder.py	Wed Jul 15 14:22:02 2009
@@ -69,8 +69,28 @@
                 raise
         http_code = f.getcode()
         if http_code != 200:
-            b.log_line("unable to fetch file, http code: %d" % http_code)
-            raise IOError, "unable to fetch file, http code: %d" % http_code
+            # if .uploadinfo also doesn't exist this means that someone
+            # deleted files at src builder side and we should fail then
+            try:
+                fui = urllib.urlopen(src_url + '.uploadinfo')
+            except IOError, error:
+                f.close()
+                # cron job will retry then
+                raise
+            if fui.get_code() != 200:
+                # no uploadinfo, so we can fail with this job in a way
+                # that it will be skipped from queue
+                b.log_line("uploadinfo file doesn't exists or is inaccesible, http code: %d" % http_code)
+                f.close()
+                fui.close()
+                return False
+            else:
+                # uploadinfo file exists but we weren't able to fetch original file,
+                # so we fail in a way where cron job will retry
+                b.log_line("unable to fetch file, http code: %d" % http_code)
+                f.close()
+                fui.close()
+                raise IOError, "unable to fetch file, http code: %d" % http_code
 
     o = chroot.popen("cat > %s" % b.src_rpm, mode = "w")
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/pld-builder.new/PLD_Builder/rpm_builder.py?r1=1.83&r2=1.84&f=u



More information about the pld-cvs-commit mailing list