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:
Tao Bao
2016-02-04 14:26:02 -08:00
parent ebadc3bd8e
commit b4cfca530c
4 changed files with 54 additions and 14 deletions

View File

@@ -30,7 +30,6 @@ import time
import zipfile
import blockimgdiff
import rangelib
from hashlib import sha1 as sha1
@@ -1255,6 +1254,7 @@ class BlockDifference(object):
OPTIONS.tempfiles.append(tmpdir)
self.path = os.path.join(tmpdir, partition)
b.Compute(self.path)
self._required_cache = b.max_stashed_size
if src is None:
_, self.device = GetTypeAndDevice("/" + partition, OPTIONS.info_dict)
@@ -1262,6 +1262,10 @@ class BlockDifference(object):
_, self.device = GetTypeAndDevice("/" + partition,
OPTIONS.source_info_dict)
@property
def required_cache(self):
return self._required_cache
def WriteScript(self, script, output_zip, progress=None):
if not self.src:
# write the output unconditionally