Don't extract archives if unchanged.
This should shave 20% (40 seconds) off our Windows cycle times, going by the graphs. It's 15% off our Linux ones, but that 15% is only 11 seconds. Change-Id: I077c3924c722d597f66fc6dec72932ed0c81660a Reviewed-on: https://boringssl-review.googlesource.com/12562 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
65241cf555
commit
0ec5639092
@ -104,8 +104,6 @@ hooks = [
|
|||||||
'boringssl/util/bot/update_clang.py',
|
'boringssl/util/bot/update_clang.py',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
# TODO(davidben): Only extract archives when they've changed. Extracting perl
|
|
||||||
# on Windows is a significant part of the cycle time.
|
|
||||||
{
|
{
|
||||||
'name': 'cmake_linux64_extract',
|
'name': 'cmake_linux64_extract',
|
||||||
'pattern': '.',
|
'pattern': '.',
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
"""Extracts archives."""
|
"""Extracts archives."""
|
||||||
|
|
||||||
|
|
||||||
|
import hashlib
|
||||||
import optparse
|
import optparse
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
@ -78,6 +79,22 @@ def main(args):
|
|||||||
# Skip archives that weren't downloaded.
|
# Skip archives that weren't downloaded.
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
with open(archive) as f:
|
||||||
|
sha256 = hashlib.sha256()
|
||||||
|
while True:
|
||||||
|
chunk = f.read(1024 * 1024)
|
||||||
|
if not chunk:
|
||||||
|
break
|
||||||
|
sha256.update(chunk)
|
||||||
|
digest = sha256.hexdigest()
|
||||||
|
|
||||||
|
stamp_path = os.path.join(output, ".boringssl_archive_digest")
|
||||||
|
if os.path.exists(stamp_path):
|
||||||
|
with open(stamp_path) as f:
|
||||||
|
if f.read().strip() == digest:
|
||||||
|
print "Already up-to-date."
|
||||||
|
return 0
|
||||||
|
|
||||||
if archive.endswith('.zip'):
|
if archive.endswith('.zip'):
|
||||||
entries = IterateZip(archive)
|
entries = IterateZip(archive)
|
||||||
elif archive.endswith('.tar.gz'):
|
elif archive.endswith('.tar.gz'):
|
||||||
@ -129,9 +146,10 @@ def main(args):
|
|||||||
finally:
|
finally:
|
||||||
entries.close()
|
entries.close()
|
||||||
|
|
||||||
if num_extracted % 100 == 0:
|
with open(stamp_path, 'w') as f:
|
||||||
print "Done. Extracted %d files." % (num_extracted,)
|
f.write(digest)
|
||||||
|
|
||||||
|
print "Done. Extracted %d files." % (num_extracted,)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user