binman: Add DecompressData function to entry class

Add a DecompressData function to entry class to allow override in child
classes and to centralize the compress and decompress in a single class.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Stefan Herbrechtsmeier 2022-08-19 16:25:24 +02:00 committed by Simon Glass
parent fa24f5578c
commit 204a27bbb2
2 changed files with 16 additions and 2 deletions

View file

@ -1120,6 +1120,21 @@ features to produce new behaviours.
data = comp_util.compress(indata, self.compress)
return data
def DecompressData(self, indata):
"""Decompress data according to the entry's compression method
Args:
indata: Data to decompress
Returns:
Decompressed data
"""
data = comp_util.decompress(indata, self.compress)
if self.compress != 'none':
self.uncomp_size = len(data)
self.uncomp_data = data
return data
@classmethod
def UseExpanded(cls, node, etype, new_etype):
"""Check whether to use an expanded entry type