summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2021-05-01 03:45:13 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2021-05-01 03:45:13 +0000
commit34949e63da56ae6e9734476dfdf70d2bece1142b (patch)
tree57c56c2d7c20b8436cfc9dcf86f522092dd43d67 /tools
parent10b66f6975ba9f7fd1afb2fb3497f850be2b4aaa (diff)
parentf63abb1cae1f389482aac2994a2fa107ce3b3de6 (diff)
Merge "Avoid to print undefined image_size and partition_size"
Diffstat (limited to 'tools')
-rwxr-xr-xtools/releasetools/build_image.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index 301d0dafef..2492da9877 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -386,13 +386,14 @@ def BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config):
in_dir, du_str,
int(prop_dict.get("partition_reserved_size", 0)),
int(prop_dict.get("partition_reserved_size", 0)) // BYTES_IN_MB))
- print(
- "The max image size for filesystem files is {} bytes ({} MB), out of a "
- "total partition size of {} bytes ({} MB).".format(
- int(prop_dict["image_size"]),
- int(prop_dict["image_size"]) // BYTES_IN_MB,
- int(prop_dict["partition_size"]),
- int(prop_dict["partition_size"]) // BYTES_IN_MB))
+ if ("image_size" in prop_dict and "partition_size" in prop_dict):
+ print(
+ "The max image size for filesystem files is {} bytes ({} MB), "
+ "out of a total partition size of {} bytes ({} MB).".format(
+ int(prop_dict["image_size"]),
+ int(prop_dict["image_size"]) // BYTES_IN_MB,
+ int(prop_dict["partition_size"]),
+ int(prop_dict["partition_size"]) // BYTES_IN_MB))
raise
if run_e2fsck and prop_dict.get("skip_fsck") != "true":