From 97fb8081ec0c8009ff5e70c054e8ece08e4465ed Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 11 Jan 2023 16:10:15 -0700 Subject: binman: Add a function to check for special section nodes This appears in two places in the code. Use a shared function instead. Signed-off-by: Simon Glass --- tools/binman/etype/section.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tools/binman/etype/section.py') diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py index 28f04cb84a..a22be7ec77 100644 --- a/tools/binman/etype/section.py +++ b/tools/binman/etype/section.py @@ -169,6 +169,17 @@ class Entry_section(Entry): self._ignore_missing = False self._filename = None + def IsSpecialSubnode(self, node): + """Check if a node is a special one used by the section itself + + Some notes are used for hashing / signatures and do not add entries to + the actual section. + + Returns: + bool: True if the node is a special one, else False + """ + return node.name.startswith('hash') or node.name.startswith('signature') + def ReadNode(self): """Read properties from the section node""" super().ReadNode() @@ -195,7 +206,7 @@ class Entry_section(Entry): def ReadEntries(self): for node in self._node.subnodes: - if node.name.startswith('hash') or node.name.startswith('signature'): + if self.IsSpecialSubnode(node): continue entry = Entry.Create(self, node, expanded=self.GetImage().use_expanded, -- cgit v1.2.3