Index: gsd_generate_index/gsd_generate_index.py |
=================================================================== |
--- gsd_generate_index/gsd_generate_index.py (revision 77689) |
+++ gsd_generate_index/gsd_generate_index.py (working copy) |
@@ -58,7 +58,7 @@ |
fields = {} |
fields['size'] = FixupSize(re.search('\tObject size:\t([0-9]+)\n', |
p_stdout).group(1)) |
- fields['md5'] = re.search('\tMD5:\t([^\n]+)\n', p_stdout).group(1) |
+ fields['md5'] = re.search('\t(MD5|Etag):\t([^\n]+)\n', p_stdout).group(2) |
fields['date'] = re.search('\tLast mod:\t([^\n]+)\n', p_stdout).group(1) |
return fields |
@@ -140,11 +140,11 @@ |
print '%s -- updated index' % path |
-def IndexWorker(index_list, mutex, directories, objects, options): |
+def IndexWorker(index_list, errors, mutex, directories, objects, options): |
while True: |
# Pluck out one index to work on, or quit if no more work left. |
mutex.acquire() |
- if not len(index_list): |
+ if not index_list: |
mutex.release() |
return |
d = index_list.pop(0) |
@@ -152,7 +152,13 @@ |
# Find just this directories children. |
children = [o for o in objects if posixpath.dirname(o) == d] |
# Generate it. |
- GenerateIndex(d, children, directories, options) |
+ try: |
+ GenerateIndex(d, children, directories, options) |
+ except Exception, e: |
+ mutex.acquire() |
+ errors.push(e) |
+ print str(e) |
+ mutex.release() |
def GenerateIndexes(path, options): |
@@ -177,8 +183,9 @@ |
if not options.path or options.path.startswith(i)] |
# Spawn workers |
mutex = threading.Lock() |
+ errors = [] |
workers = [threading.Thread(target=IndexWorker, |
- args=(index_list, mutex, |
+ args=(index_list, errors, mutex, |
directories, objects, options)) |
for _ in range(0, NUM_THREADS)] |
# Start threads. |
@@ -187,6 +194,8 @@ |
# Wait for them to finish. |
for w in workers: |
w.join() |
+ if errors: |
+ return 2 |
return 0 |