diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2018-06-29 16:46:50 +0200 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2018-07-02 19:00:48 +0200 |
commit | 8293b295beb8c76113f525f41ba16e204a7cb22b (patch) | |
tree | 6b89b51c58190b051437ce3047285f31f11fff9f /python/servo/bootstrap_commands.py | |
parent | 9e544c2aae5d94be562683e216d1b64d888930ff (diff) | |
download | servo-8293b295beb8c76113f525f41ba16e204a7cb22b.tar.gz servo-8293b295beb8c76113f525f41ba16e204a7cb22b.zip |
bootstrap-android: check SHA1 hashes of downloaded archives
Diffstat (limited to 'python/servo/bootstrap_commands.py')
-rw-r--r-- | python/servo/bootstrap_commands.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/python/servo/bootstrap_commands.py b/python/servo/bootstrap_commands.py index 3cf7f36a0a7..07c31c660cd 100644 --- a/python/servo/bootstrap_commands.py +++ b/python/servo/bootstrap_commands.py @@ -29,7 +29,7 @@ from mach.decorators import ( import servo.bootstrap as bootstrap from servo.command_base import CommandBase, cd, check_call -from servo.util import delete, download_bytes, download_file, extract +from servo.util import delete, download_bytes, download_file, extract, check_hash @CommandProvider @@ -63,7 +63,6 @@ class MachCommands(CommandBase): help='Run SDK component install and emulator image creation again') def bootstrap_android(self, update=False): - # Available filenames: see https://dl.google.com/android/repository/repository2-1.xml ndk = "android-ndk-r12b-{system}-{arch}" tools = "sdk-tools-{system}-4333796" @@ -73,6 +72,19 @@ class MachCommands(CommandBase): ("servo-x86", "28", "google_apis;x86"), ] + known_sha1 = { + # https://dl.google.com/android/repository/repository2-1.xml + "sdk-tools-darwin-4333796.zip": "ed85ea7b59bc3483ce0af4c198523ba044e083ad", + "sdk-tools-linux-4333796.zip": "8c7c28554a32318461802c1291d76fccfafde054", + "sdk-tools-windows-4333796.zip": "aa298b5346ee0d63940d13609fe6bec621384510", + + # https://developer.android.com/ndk/downloads/older_releases + "android-ndk-r12b-windows-x86.zip": "8e6eef0091dac2f3c7a1ecbb7070d4fa22212c04", + "android-ndk-r12b-windows-x86_64.zip": "337746d8579a1c65e8a69bf9cbdc9849bcacf7f5", + "android-ndk-r12b-darwin-x86_64.zip": "e257fe12f8947be9f79c10c3fffe87fb9406118a", + "android-ndk-r12b-linux-x86_64.zip": "170a119bfa0f0ce5dc932405eaa3a7cc61b27694", + } + toolchains = path.join(self.context.topdir, "android-toolchains") if not path.isdir(toolchains): os.makedirs(toolchains) @@ -89,8 +101,9 @@ class MachCommands(CommandBase): if not path.isfile(archive): download_file(filename, url, archive) + check_hash(archive, known_sha1[filename], "sha1") print("Extracting " + filename) - remove = False # Set to False to avoid repeated downloads while debugging this script + remove = True # Set to False to avoid repeated downloads while debugging this script if flatten: extracted = final + "_" extract(archive, extracted, remove=remove) |