releasetools: Add two new entries to metadata.
Add "ota-required-cache" into the metadata file in an OTA package,
which shows the minimum free space on /cache to apply the update.
Add "ota-type" into the metadata file, which shows the OTA type for
this package (i.e. one of FILE, BLOCK and AB).
Also add the cache free space check into updater-script when generating
block-based incremental OTAs (we only had such lines for file-based
incrementals before).
Bug: 26731903
Change-Id: Id6ff0fc4cdfb1443636b0b3800b0f8bddb5bb1d0
(cherry picked from commit d8d14bec0d
)
This commit is contained in:
@@ -271,6 +271,7 @@ class BlockImageDiff(object):
|
||||
self.transfers = []
|
||||
self.src_basenames = {}
|
||||
self.src_numpatterns = {}
|
||||
self._max_stashed_size = 0
|
||||
|
||||
assert version in (1, 2, 3, 4)
|
||||
|
||||
@@ -288,6 +289,10 @@ class BlockImageDiff(object):
|
||||
self.AssertPartition(src.care_map, src.file_map.values())
|
||||
self.AssertPartition(tgt.care_map, tgt.file_map.values())
|
||||
|
||||
@property
|
||||
def max_stashed_size(self):
|
||||
return self._max_stashed_size
|
||||
|
||||
def Compute(self, prefix):
|
||||
# When looking for a source file to use as the diff input for a
|
||||
# target file, we try:
|
||||
@@ -558,17 +563,17 @@ class BlockImageDiff(object):
|
||||
f.write(i)
|
||||
|
||||
if self.version >= 2:
|
||||
max_stashed_size = max_stashed_blocks * self.tgt.blocksize
|
||||
self._max_stashed_size = max_stashed_blocks * self.tgt.blocksize
|
||||
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))
|
||||
max_stashed_blocks, self._max_stashed_size, max_allowed,
|
||||
self._max_stashed_size * 100.0 / max_allowed))
|
||||
else:
|
||||
print("max stashed blocks: %d (%d bytes), limit: <unknown>\n" % (
|
||||
max_stashed_blocks, max_stashed_size))
|
||||
max_stashed_blocks, self._max_stashed_size))
|
||||
|
||||
def ReviseStashSize(self):
|
||||
print("Revising stash size...")
|
||||
|
Reference in New Issue
Block a user