forked from openkylin/platform_build
Merge "Infer prebuilt image size"
This commit is contained in:
commit
08d07f5aa9
|
@ -659,17 +659,25 @@ def AddSuperEmpty(output_zip):
|
||||||
def AddSuperSplit(output_zip):
|
def AddSuperSplit(output_zip):
|
||||||
"""Create split super_*.img and store it in output_zip."""
|
"""Create split super_*.img and store it in output_zip."""
|
||||||
|
|
||||||
|
def GetPartitionSizeFromImage(img):
|
||||||
|
try:
|
||||||
|
simg = sparse_img.SparseImage(img)
|
||||||
|
return simg.blocksize * simg.total_blocks
|
||||||
|
except ValueError:
|
||||||
|
return os.path.getsize(img)
|
||||||
|
|
||||||
def TransformPartitionArg(arg):
|
def TransformPartitionArg(arg):
|
||||||
lst = arg.split(':')
|
lst = arg.split(':')
|
||||||
# Because --auto-slot-suffixing for A/B, there is no need to remove suffix.
|
# Because --auto-slot-suffixing for A/B, there is no need to remove suffix.
|
||||||
name = lst[0]
|
name = lst[0]
|
||||||
assert name + '_size' in OPTIONS.info_dict, (
|
if name + '_size' in OPTIONS.info_dict:
|
||||||
"{} is a prebuilt. Dynamic partitions with prebuilt images "
|
size = str(OPTIONS.info_dict[name + '_size'])
|
||||||
"are not supported yet.".format(name))
|
logger.info("Using %s_size = %s", name, size)
|
||||||
size = OPTIONS.info_dict[name + '_size']
|
else:
|
||||||
assert size is not None, \
|
size = str(GetPartitionSizeFromImage(
|
||||||
'{0}_size is not found; is {0} built?'.format(name)
|
os.path.join(OPTIONS.input_tmp, "IMAGES", '{}.img'.format(name))))
|
||||||
lst[2] = str(size)
|
logger.info("Using size of prebuilt %s = %s", name, size)
|
||||||
|
lst[2] = size
|
||||||
return ':'.join(lst)
|
return ':'.join(lst)
|
||||||
|
|
||||||
def GetLpmakeArgsWithSizes():
|
def GetLpmakeArgsWithSizes():
|
||||||
|
|
Loading…
Reference in New Issue