OSDN Git Service

releasetools: Change the base_fs assertion into warnings.
authorTao Bao <tbao@google.com>
Tue, 3 May 2016 15:01:19 +0000 (08:01 -0700)
committerTao Bao <tbao@google.com>
Tue, 3 May 2016 15:05:09 +0000 (08:05 -0700)
commit f54216f29238a67aad1199a0e85d09e443740bf0 packed the base_fs files
into target_files.zip and added assertion to ensure the existence of the
files. We don't want to fail the OTA generation for the target_files.zip
without the base_fs files. Change the assertion into warnings instead.

Bug: 28547368
Change-Id: I6fd758a0a4fdfff02d1640fa46cf43d971627e26

tools/releasetools/common.py

index 1dc048f..60f44db 100644 (file)
@@ -186,16 +186,22 @@ def LoadInfoDict(input_file, input_dir=None):
     if "system_base_fs_file" in d:
       basename = os.path.basename(d["system_base_fs_file"])
       system_base_fs_file = os.path.join(input_dir, "META", basename)
-      assert os.path.exists(system_base_fs_file), \
-          "failed to find system base fs file: %s" % (system_base_fs_file,)
-      d["system_base_fs_file"] = system_base_fs_file
+      if os.path.exists(system_base_fs_file):
+        d["system_base_fs_file"] = system_base_fs_file
+      else:
+        print "Warning: failed to find system base fs file: %s" % (
+            system_base_fs_file,)
+        del d["system_base_fs_file"]
 
     if "vendor_base_fs_file" in d:
       basename = os.path.basename(d["vendor_base_fs_file"])
       vendor_base_fs_file = os.path.join(input_dir, "META", basename)
-      assert os.path.exists(vendor_base_fs_file), \
-          "failed to find vendor base fs file: %s" % (vendor_base_fs_file,)
-      d["vendor_base_fs_file"] = vendor_base_fs_file
+      if os.path.exists(vendor_base_fs_file):
+        d["vendor_base_fs_file"] = vendor_base_fs_file
+      else:
+        print "Warning: failed to find vendor base fs file: %s" % (
+            vendor_base_fs_file,)
+        del d["vendor_base_fs_file"]
 
   try:
     data = read_helper("META/imagesizes.txt")