Merge changes from topic "dap_size_check"

* changes:
  Only assert-max-image-size for static partitions.
  sparse_img.py --get_partition_size return size of partition
  Revert "Fix dynamic partition size check for devices with recovery"
This commit is contained in:
Treehugger Robot
2019-04-09 02:17:36 +00:00
committed by Gerrit Code Review
5 changed files with 45 additions and 70 deletions

View File

@@ -58,16 +58,8 @@ logger = logging.getLogger(__name__)
UNZIP_PATTERN = ["IMAGES/*", "META/*"]
def GetPartitionSizeFromImage(img):
try:
simg = sparse_img.SparseImage(img)
return simg.blocksize * simg.total_blocks
except ValueError:
return os.path.getsize(img)
def GetArgumentsForImage(partition, group, image=None):
image_size = GetPartitionSizeFromImage(image) if image else 0
image_size = sparse_img.GetImagePartitionSize(image) if image else 0
cmd = ["--partition",
"{}:readonly:{}:{}".format(partition, image_size, group)]