diff options
-rwxr-xr-x | scripts/install-buildtools | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/scripts/install-buildtools b/scripts/install-buildtools index 2218f3ffac..a34474ea84 100755 --- a/scripts/install-buildtools +++ b/scripts/install-buildtools | |||
@@ -238,19 +238,15 @@ def main(): | |||
238 | # Verify checksum | 238 | # Verify checksum |
239 | if args.check: | 239 | if args.check: |
240 | logger.info("Fetching buildtools installer checksum") | 240 | logger.info("Fetching buildtools installer checksum") |
241 | checksum_type = "" | 241 | checksum_type = "sha256sum" |
242 | for checksum_type in ["md5sum", "sha256sum"]: | 242 | check_url = "{}.{}".format(buildtools_url, checksum_type) |
243 | check_url = "{}.{}".format(buildtools_url, checksum_type) | 243 | checksum_filename = "{}.{}".format(filename, checksum_type) |
244 | checksum_filename = "{}.{}".format(filename, checksum_type) | 244 | tmpbuildtools_checksum = os.path.join(tmpsdk_dir, checksum_filename) |
245 | tmpbuildtools_checksum = os.path.join(tmpsdk_dir, checksum_filename) | 245 | ret = subprocess.call("wget -q -O %s %s" % |
246 | ret = subprocess.call("wget -q -O %s %s" % | 246 | (tmpbuildtools_checksum, check_url), shell=True) |
247 | (tmpbuildtools_checksum, check_url), shell=True) | 247 | if ret != 0: |
248 | if ret == 0: | 248 | logger.error("Could not download file from %s" % check_url) |
249 | break | 249 | return ret |
250 | else: | ||
251 | if ret != 0: | ||
252 | logger.error("Could not download file from %s" % check_url) | ||
253 | return ret | ||
254 | regex = re.compile(r"^(?P<checksum>[0-9a-f]+)\s+(?P<path>.*/)?(?P<filename>.*)$") | 250 | regex = re.compile(r"^(?P<checksum>[0-9a-f]+)\s+(?P<path>.*/)?(?P<filename>.*)$") |
255 | with open(tmpbuildtools_checksum, 'rb') as f: | 251 | with open(tmpbuildtools_checksum, 'rb') as f: |
256 | original = f.read() | 252 | original = f.read() |
@@ -263,10 +259,7 @@ def main(): | |||
263 | logger.error("Filename does not match name in checksum") | 259 | logger.error("Filename does not match name in checksum") |
264 | return 1 | 260 | return 1 |
265 | checksum = m.group('checksum') | 261 | checksum = m.group('checksum') |
266 | if checksum_type == "md5sum": | 262 | checksum_value = sha256_file(tmpbuildtools) |
267 | checksum_value = md5_file(tmpbuildtools) | ||
268 | else: | ||
269 | checksum_value = sha256_file(tmpbuildtools) | ||
270 | if checksum == checksum_value: | 263 | if checksum == checksum_value: |
271 | logger.info("Checksum success") | 264 | logger.info("Checksum success") |
272 | else: | 265 | else: |