pld-builder.new: PLD_Builder/file_sender.py Try to copy whatever is possibl...
arekm
arekm at pld-linux.org
Mon Oct 5 17:13:41 CEST 2009
Author: arekm Date: Mon Oct 5 15:13:41 2009 GMT
Module: pld-builder.new Tag: HEAD
---- Log message:
Try to copy whatever is possible and simply skip (with logging) problematic entries.
---- Files affected:
pld-builder.new/PLD_Builder:
file_sender.py (1.30 -> 1.31)
---- Diffs:
================================================================
Index: pld-builder.new/PLD_Builder/file_sender.py
diff -u pld-builder.new/PLD_Builder/file_sender.py:1.30 pld-builder.new/PLD_Builder/file_sender.py:1.31
--- pld-builder.new/PLD_Builder/file_sender.py:1.30 Mon May 25 18:14:15 2009
+++ pld-builder.new/PLD_Builder/file_sender.py Mon Oct 5 17:13:36 2009
@@ -97,25 +97,27 @@
return 0
def send_file(src, target):
- log.notice("sending %s to %s (size %d bytes)" % (src, target, os.stat(src).st_size))
- m = re.match('rsync://([^/]+)/.*', target)
- if m:
- return rsync_file(src, target, host = m.group(1))
- if target != "" and target[0] == '/':
- return copy_file(src, target)
- m = re.match('scp://([^@:]+@[^/:]+)(:|)(.*)', target)
- if m:
- return scp_file(src, m.group(1) + ":" + m.group(3))
- m = re.match('ssh\+rsync://([^@:]+@[^/:]+)(:|)(.*)', target)
- if m:
- return rsync_ssh_file(src, m.group(1) + ":" + m.group(3))
- m = re.match('http://.*', target)
- if m:
- return post_file(src, target)
- log.alert("unsupported protocol: %s" % target)
- # pretend everything went OK, so file is removed from queue,
- # and doesn't cause any additional problems
- return 0
+ try:
+ log.notice("sending %s to %s (size %d bytes)" % (src, target, os.stat(src).st_size))
+ m = re.match('rsync://([^/]+)/.*', target)
+ if m:
+ return rsync_file(src, target, host = m.group(1))
+ if target != "" and target[0] == '/':
+ return copy_file(src, target)
+ m = re.match('scp://([^@:]+@[^/:]+)(:|)(.*)', target)
+ if m:
+ return scp_file(src, m.group(1) + ":" + m.group(3))
+ m = re.match('ssh\+rsync://([^@:]+@[^/:]+)(:|)(.*)', target)
+ if m:
+ return rsync_ssh_file(src, m.group(1) + ":" + m.group(3))
+ m = re.match('http://.*', target)
+ if m:
+ return post_file(src, target)
+ log.alert("unsupported protocol: %s" % target)
+ except OSError, e:
+ log.error("send_file(%s, %s): %s" % (src, target, e)
+ return False
+ return True
def maybe_flush_queue(dir):
retry_delay = 0
@@ -159,19 +161,20 @@
q.sort(mycmp)
error = None
- remaining = q
+ # copy of q
+ remaining = q[:]
for d in q:
- if send_file(d['_file'], d['Target']):
+ if not send_file(d['_file'], d['Target']):
error = d
- break
+ continue
if os.access(d['_file'] + ".info", os.F_OK):
- if send_file(d['_file'] + ".info", d['Target'] + ".info"):
+ if not send_file(d['_file'] + ".info", d['Target'] + ".info"):
error = d
- break
+ continue
os.unlink(d['_file'] + ".info")
os.unlink(d['_file'])
os.unlink(d['_desc'])
- remaining = q[1:]
+ remaining.remove(d)
if error != None:
emails = {}
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/pld-builder.new/PLD_Builder/file_sender.py?r1=1.30&r2=1.31&f=u
More information about the pld-cvs-commit
mailing list