]> glassweightruler.freedombox.rocks Git - waydroid.git/blobdiff - tools/helpers/images.py
Update issue templates
[waydroid.git] / tools / helpers / images.py
index 36af1e6168de592fb3da99ff9f6071ec69260de4..b54a30161a21579adc0bd78d39b772810cee0dfd 100644 (file)
@@ -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)