Chromium Code Reviews| Index: build/extract_from_cab.py |
| =================================================================== |
| --- build/extract_from_cab.py (revision 114132) |
| +++ build/extract_from_cab.py (working copy) |
| @@ -12,6 +12,7 @@ |
| lock_file = os.path.join(tempfile.gettempdir(), 'expand.lock') |
| + |
| def acquire_lock(): |
| while True: |
| try: |
| @@ -20,13 +21,15 @@ |
| except OSError as e: |
| if e.errno != errno.EEXIST: |
| raise |
| - print 'Cab extraction could not get exclusive lock. Retrying in 1 sec...' |
| - time.sleep(1000) |
| + print 'Cab extraction could not get exclusive lock. Retrying in 10 sec...' |
| + time.sleep(10) |
|
M-A Ruel
2011/12/13 02:16:26
in fact, make it 100ms.
apatrick_chromium
2011/12/13 02:20:58
Done.
|
| + |
| def release_lock(fd): |
| os.close(fd) |
| os.unlink(lock_file) |
| + |
| def main(): |
| if len(sys.argv) != 4: |
| print 'Usage: extract_from_cab.py cab_path archived_file output_dir' |
| @@ -40,13 +43,7 @@ |
| level = subprocess.call( |
| ['expand', cab_path, '-F:' + archived_file, output_dir]) |
| if level != 0: |
|
M-A Ruel
2011/12/13 02:16:26
return on line 43 instead.
apatrick_chromium
2011/12/13 02:20:58
If it succeeds it is intended to touch the extract
|
| - print 'Cab extraction(%s, %s, %s) failed.' % ( |
| - cab_path, archived_file, output_dir) |
| - print 'Trying a second time.' |
| - level = subprocess.call( |
| - ['expand', cab_path, '-F:' + archived_file, output_dir]) |
| - if level != 0: |
| - return level |
| + return level |
| finally: |
| release_lock(lock_fd) |