Potential fix for the failing Fuchsia SDK update hook.
It appears using external process to write to a file we hold an open handle for isn't 100% reliable (I suspect we need an fsync somewhere or maybe gsutil is doing 'mv' somewhere and writes to another inode, or something like that). Reopening the file before reading from it fixes the bug, at least locally for me. R=scottmg@chromium.org, kbr@chromium.org BUG=795330 Change-Id: I498540ec62439c02243b84a5577c4b225ba5e1f3 Reviewed-on: https://chromium-review.googlesource.com/830257 Commit-Queue: Sergey Ulanov <sergeyu@chromium.org> Reviewed-by: Sergey Ulanov <sergeyu@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#524439} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 48fdf63300aae84f8159c22831df8cff24b5d984
This commit is contained in:
Родитель
bb86bde677
Коммит
85765be335
|
@ -46,14 +46,19 @@ def main():
|
|||
if os.path.isdir(output_dir):
|
||||
shutil.rmtree(output_dir)
|
||||
|
||||
bucket = 'gs://fuchsia/sdk/linux-amd64/'
|
||||
with tempfile.NamedTemporaryFile() as f:
|
||||
fd, tmp = tempfile.mkstemp()
|
||||
os.close(fd)
|
||||
|
||||
try:
|
||||
bucket = 'gs://fuchsia/sdk/linux-amd64/'
|
||||
cmd = [os.path.join(find_depot_tools.DEPOT_TOOLS_PATH, 'gsutil.py'),
|
||||
'cp', bucket + sdk_hash, f.name]
|
||||
'cp', bucket + sdk_hash, tmp]
|
||||
subprocess.check_call(cmd)
|
||||
f.seek(0)
|
||||
EnsureDirExists(output_dir)
|
||||
tarfile.open(mode='r:gz', fileobj=f).extractall(path=output_dir)
|
||||
with open(tmp, 'rb') as f:
|
||||
EnsureDirExists(output_dir)
|
||||
tarfile.open(mode='r:gz', fileobj=f).extractall(path=output_dir)
|
||||
finally:
|
||||
os.remove(tmp)
|
||||
|
||||
with open(hash_filename, 'w') as f:
|
||||
f.write(sdk_hash)
|
||||
|
|
Загрузка…
Ссылка в новой задаче