From 204a27bbb222c61bf5aaecbf7e00a5a8aa835bf9 Mon Sep 17 00:00:00 2001 From: Stefan Herbrechtsmeier Date: Fri, 19 Aug 2022 16:25:24 +0200 Subject: 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 Reviewed-by: Simon Glass --- tools/binman/entry.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tools/binman/entry.py') diff --git a/tools/binman/entry.py b/tools/binman/entry.py index 1795d5cf300..b42b6df611b 100644 --- a/tools/binman/entry.py +++ b/tools/binman/entry.py @@ -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 -- cgit v1.2.3