Add option to enable lz4diff
When lz4diff is enabled, we inject the host copy of liblz4.so in target_file to delta_generator. This is to ensure that host tooling can produce same compressed output as the device. Test: th Bug: 206729162 Change-Id: I2d8206f7ec54fadedea16bf3d811b8353bc9414d
This commit is contained in:
@@ -640,6 +640,28 @@ def ConstructOtaApexInfo(target_zip, source_file=None):
|
||||
return target_apex_proto.SerializeToString()
|
||||
|
||||
|
||||
def IsLz4diffCompatible(source_file: str, target_file: str):
|
||||
"""Check whether lz4diff versions in two builds are compatible
|
||||
|
||||
Args:
|
||||
source_file: Path to source build's target_file.zip
|
||||
target_file: Path to target build's target_file.zip
|
||||
|
||||
Returns:
|
||||
bool true if and only if lz4diff versions are compatible
|
||||
"""
|
||||
if source_file is None or target_file is None:
|
||||
return False
|
||||
# Right now we enable lz4diff as long as source build has liblz4.so.
|
||||
# In the future we might introduce version system to lz4diff as well.
|
||||
if zipfile.is_zipfile(source_file):
|
||||
with zipfile.ZipFile(source_file, "r") as zfp:
|
||||
return "META/liblz4.so" in zfp.namelist()
|
||||
else:
|
||||
assert os.path.isdir(source_file)
|
||||
return os.path.exists(os.path.join(source_file, "META", "liblz4.so"))
|
||||
|
||||
|
||||
def IsZucchiniCompatible(source_file: str, target_file: str):
|
||||
"""Check whether zucchini versions in two builds are compatible
|
||||
|
||||
|
Reference in New Issue
Block a user