summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Boie <andrew.p.boie@intel.com>2012-02-14 09:32:52 -0800
committerDoug Zongker <dougz@android.com>2012-02-21 12:45:23 -0800
commit0f9aec837f98cadb2d959b235e7eee8db2bd299e (patch)
tree9e426f47bec4c4dd06c96fc4d3a0401c90839f06
parent6bfa911394b279e0e57e7ba0bf40a33a8a6e75e3 (diff)
downloadbuild-0f9aec837f98cadb2d959b235e7eee8db2bd299e.zip
build-0f9aec837f98cadb2d959b235e7eee8db2bd299e.tar.gz
build-0f9aec837f98cadb2d959b235e7eee8db2bd299e.tar.bz2
releasetools: Fix image size checking
A block of code that should be evaluated for all image types was instead only being run for yaffs partitions. Change-Id: I83ccbd7fa3c1bc02b9bba0832701ecc258e40a7d Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
-rw-r--r--tools/releasetools/common.py27
1 files changed, 15 insertions, 12 deletions
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index a6ab055..8196b3c 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -390,24 +390,27 @@ def CheckSize(data, target, info_dict):
if mount_point == "/userdata": mount_point = "/data"
p = info_dict["fstab"][mount_point]
fs_type = p.fs_type
- limit = info_dict.get(p.device + "_size", None)
+ device = p.device
+ if "/" in device:
+ device = device[device.rfind("/")+1:]
+ limit = info_dict.get(device + "_size", None)
if not fs_type or not limit: return
if fs_type == "yaffs2":
# image size should be increased by 1/64th to account for the
# spare area (64 bytes per 2k page)
limit = limit / 2048 * (2048+64)
- size = len(data)
- pct = float(size) * 100.0 / limit
- msg = "%s size (%d) is %.2f%% of limit (%d)" % (target, size, pct, limit)
- if pct >= 99.0:
- raise ExternalError(msg)
- elif pct >= 95.0:
- print
- print " WARNING: ", msg
- print
- elif OPTIONS.verbose:
- print " ", msg
+ size = len(data)
+ pct = float(size) * 100.0 / limit
+ msg = "%s size (%d) is %.2f%% of limit (%d)" % (target, size, pct, limit)
+ if pct >= 99.0:
+ raise ExternalError(msg)
+ elif pct >= 95.0:
+ print
+ print " WARNING: ", msg
+ print
+ elif OPTIONS.verbose:
+ print " ", msg
def ReadApkCerts(tf_zip):