Switch DEPS actions on bots to Python 3.

In doing so, I think this fixes a bug on Windows where extract.py was
digesting the archive in text mode. (Doesn't particularly matter, though
by using the correct digest, we will end up re-extracting the files
once.)

Change-Id: Ia7effe5f9c228c1a702cba8e6380975b59261808
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50166
Reviewed-by: Adam Langley <agl@google.com>
grpc-202302
David Benjamin 3 years ago committed by Adam Langley
parent 69030a0cea
commit 17c38b39ee
  1. 12
      util/bot/DEPS
  2. 12
      util/bot/extract.py

@ -127,7 +127,7 @@ hooks = [
'name': 'cmake_win32_extract',
'pattern': '.',
'condition': 'host_os == "win"',
'action': [ 'python',
'action': [ 'python3',
'boringssl/util/bot/extract.py',
'boringssl/util/bot/cmake-win32.zip',
'boringssl/util/bot/cmake-win32/',
@ -149,7 +149,7 @@ hooks = [
'name': 'perl_win32_extract',
'pattern': '.',
'condition': 'host_os == "win"',
'action': [ 'python',
'action': [ 'python3',
'boringssl/util/bot/extract.py',
'--no-prefix',
'boringssl/util/bot/perl-win32.zip',
@ -172,7 +172,7 @@ hooks = [
'name': 'win_toolchain',
'pattern': '.',
'condition': 'host_os == "win"',
'action': [ 'python',
'action': [ 'python3',
'boringssl/util/bot/vs_toolchain.py',
'update',
Var('vs_version'),
@ -182,7 +182,7 @@ hooks = [
'name': 'clang',
'pattern': '.',
'condition': 'checkout_clang',
'action': [ 'python',
'action': [ 'python3',
'boringssl/util/bot/update_clang.py',
],
},
@ -200,7 +200,7 @@ hooks = [
'name': 'sde_linux64_extract',
'pattern': '.',
'condition': 'checkout_sde and host_os == "linux"',
'action': [ 'python',
'action': [ 'python3',
'boringssl/util/bot/extract.py',
'boringssl/util/bot/sde-linux64.tar.bz2',
'boringssl/util/bot/sde-linux64/',
@ -220,7 +220,7 @@ hooks = [
'name': 'sde_win32_extract',
'pattern': '.',
'condition': 'checkout_sde and host_os == "win"',
'action': [ 'python',
'action': [ 'python3',
'boringssl/util/bot/extract.py',
'boringssl/util/bot/sde-win32.tar.bz2',
'boringssl/util/bot/sde-win32/',

@ -96,7 +96,7 @@ def main(args):
# Skip archives that weren't downloaded.
return 0
with open(archive) as f:
with open(archive, 'rb') as f:
sha256 = hashlib.sha256()
while True:
chunk = f.read(1024 * 1024)
@ -109,7 +109,7 @@ def main(args):
if os.path.exists(stamp_path):
with open(stamp_path) as f:
if f.read().strip() == digest:
print "Already up-to-date."
print("Already up-to-date.")
return 0
if archive.endswith('.zip'):
@ -123,10 +123,10 @@ def main(args):
try:
if os.path.exists(output):
print "Removing %s" % (output, )
print("Removing %s" % (output, ))
shutil.rmtree(output)
print "Extracting %s to %s" % (archive, output)
print("Extracting %s to %s" % (archive, output))
prefix = None
num_extracted = 0
for entry in entries:
@ -166,14 +166,14 @@ def main(args):
# Print every 100 files, so bots do not time out on large archives.
num_extracted += 1
if num_extracted % 100 == 0:
print "Extracted %d files..." % (num_extracted,)
print("Extracted %d files..." % (num_extracted,))
finally:
entries.close()
with open(stamp_path, 'w') as f:
f.write(digest)
print "Done. Extracted %d files." % (num_extracted,)
print("Done. Extracted %d files." % (num_extracted,))
return 0

Loading…
Cancel
Save