summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-13 03:32:12 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-13 03:32:12 +0000
commit964528662c380f800e1876987d7f82be9ba4427b (patch)
tree92d4ac0b9d0d70321c7a58b80866144f07d266bf /build
parentfbc338b3d6ca072647a4fb03dd117b9841c34e94 (diff)
downloadchromium_src-964528662c380f800e1876987d7f82be9ba4427b.zip
chromium_src-964528662c380f800e1876987d7f82be9ba4427b.tar.gz
chromium_src-964528662c380f800e1876987d7f82be9ba4427b.tar.bz2
Address comments in 8921029 extract_from_cab script now takes a global lock while extracting from the CAB file.
http://codereview.chromium.org/8921029/ BUG=107291 Review URL: http://codereview.chromium.org/8929001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114173 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rwxr-xr-xbuild/extract_from_cab.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/build/extract_from_cab.py b/build/extract_from_cab.py
index 278c657..d04bcfd 100755
--- a/build/extract_from_cab.py
+++ b/build/extract_from_cab.py
@@ -12,6 +12,7 @@ import tempfile
lock_file = os.path.join(tempfile.gettempdir(), 'expand.lock')
+
def acquire_lock():
while True:
try:
@@ -20,13 +21,15 @@ def acquire_lock():
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 100ms...'
+ time.sleep(0.1)
+
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 @@ def main():
level = subprocess.call(
['expand', cab_path, '-F:' + archived_file, output_dir])
if level != 0:
- 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)