summaryrefslogtreecommitdiffstats
path: root/tools/releasetools/blockimgdiff.py
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2015-08-07 19:49:45 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2015-11-06 12:34:26 -0800
commite964714a06c158b41f90e49c025607fa9455c781 (patch)
tree397c81cee9c1247a00433c201e284fd72308d2af /tools/releasetools/blockimgdiff.py
parent795f8250300badcd6cd65be9d69e78838bc29d15 (diff)
downloadbuild-e964714a06c158b41f90e49c025607fa9455c781.zip
build-e964714a06c158b41f90e49c025607fa9455c781.tar.gz
build-e964714a06c158b41f90e49c025607fa9455c781.tar.bz2
Change the cache partition size check into warnings.
For some old builds, we may not define cache partition size. Change the exception into a warning to make the script backward compatible. Change-Id: Ie94c7fbb1a9f3a7db3f16e8d845e493a534aac5b
Diffstat (limited to 'tools/releasetools/blockimgdiff.py')
-rw-r--r--tools/releasetools/blockimgdiff.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/tools/releasetools/blockimgdiff.py b/tools/releasetools/blockimgdiff.py
index cb6fc85..a6c6bd8 100644
--- a/tools/releasetools/blockimgdiff.py
+++ b/tools/releasetools/blockimgdiff.py
@@ -483,7 +483,7 @@ class BlockImageDiff(object):
if free_string:
out.append("".join(free_string))
- if self.version >= 2:
+ if self.version >= 2 and common.OPTIONS.cache_size is not None:
# Sanity check: abort if we're going to need more stash space than
# the allowed size (cache_size * threshold). There are two purposes
# of having a threshold here. a) Part of the cache may have been
@@ -524,10 +524,16 @@ class BlockImageDiff(object):
if self.version >= 2:
max_stashed_size = max_stashed_blocks * self.tgt.blocksize
- max_allowed = common.OPTIONS.cache_size * common.OPTIONS.stash_threshold
- print("max stashed blocks: %d (%d bytes), limit: %d bytes (%.2f%%)\n" % (
- max_stashed_blocks, max_stashed_size, max_allowed,
- max_stashed_size * 100.0 / max_allowed))
+ OPTIONS = common.OPTIONS
+ if OPTIONS.cache_size is not None:
+ max_allowed = OPTIONS.cache_size * OPTIONS.stash_threshold
+ print("max stashed blocks: %d (%d bytes), "
+ "limit: %d bytes (%.2f%%)\n" % (
+ max_stashed_blocks, max_stashed_size, max_allowed,
+ max_stashed_size * 100.0 / max_allowed))
+ else:
+ print("max stashed blocks: %d (%d bytes), limit: <unknown>\n" % (
+ max_stashed_blocks, max_stashed_size))
def ReviseStashSize(self):
print("Revising stash size...")