X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/waydroid.git/blobdiff_plain/f9de8c4283ffa11c0382eff5952422f0bb64159a..f44ba88220d9d323d76b8ddead6012c94d66697b:/tools/helpers/images.py diff --git a/tools/helpers/images.py b/tools/helpers/images.py index 36af1e6..b54a301 100644 --- a/tools/helpers/images.py +++ b/tools/helpers/images.py @@ -26,7 +26,7 @@ def get(args): if system_request[0] != 200: raise ValueError( "Failed to get system OTA channel: {}, error: {}".format(args.system_ota, system_request[0])) - system_responses = json.loads(system_request[1])["response"] + system_responses = json.loads(system_request[1].decode('utf8'))["response"] if len(system_responses) < 1: raise ValueError("No images found on system channel") @@ -36,6 +36,10 @@ def get(args): args, system_response['url'], system_response['filename'], cache=False) logging.info("Validating system image") if sha256sum(images_zip) != system_response['id']: + try: + os.remove(images_zip) + except: + pass raise ValueError("Downloaded system image hash doesn't match, expected: {}".format( system_response['id'])) logging.info("Extracting to " + args.images_path) @@ -51,7 +55,7 @@ def get(args): if vendor_request[0] != 200: raise ValueError( "Failed to get vendor OTA channel: {}, error: {}".format(vendor_ota, vendor_request[0])) - vendor_responses = json.loads(vendor_request[1])["response"] + vendor_responses = json.loads(vendor_request[1].decode('utf8'))["response"] if len(vendor_responses) < 1: raise ValueError("No images found on vendor channel") @@ -61,6 +65,10 @@ def get(args): args, vendor_response['url'], vendor_response['filename'], cache=False) logging.info("Validating vendor image") if sha256sum(images_zip) != vendor_response['id']: + try: + os.remove(images_zip) + except: + pass raise ValueError("Downloaded vendor image hash doesn't match, expected: {}".format( vendor_response['id'])) logging.info("Extracting to " + args.images_path)