sparse_img.py --get_partition_size return size of partition
Also, move code from build_super_image.py to sparse_img.py. Test: sparse_img.py on sparse and non-sparse images Bug: 122377935 Change-Id: Ie91fdfdbb54298ea27eb20d1b5363aeb1470356e
This commit is contained in:
@@ -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)]
|
||||
|
Reference in New Issue
Block a user