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 <sjg@chromium.org>
This commit is contained in:
@@ -655,8 +655,7 @@ class Entry_fit(Entry_section):
|
|||||||
|
|
||||||
for subnode in node.subnodes:
|
for subnode in node.subnodes:
|
||||||
subnode_path = f'{rel_path}/{subnode.name}'
|
subnode_path = f'{rel_path}/{subnode.name}'
|
||||||
if has_images and not (subnode.name.startswith('hash') or
|
if has_images and not self.IsSpecialSubnode(subnode):
|
||||||
subnode.name.startswith('signature')):
|
|
||||||
# This subnode is a content node not meant to appear in
|
# This subnode is a content node not meant to appear in
|
||||||
# the FIT (e.g. "/images/kernel/u-boot"), so don't call
|
# the FIT (e.g. "/images/kernel/u-boot"), so don't call
|
||||||
# fsw.add_node() or _add_node() for it.
|
# fsw.add_node() or _add_node() for it.
|
||||||
|
@@ -169,6 +169,17 @@ class Entry_section(Entry):
|
|||||||
self._ignore_missing = False
|
self._ignore_missing = False
|
||||||
self._filename = None
|
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):
|
def ReadNode(self):
|
||||||
"""Read properties from the section node"""
|
"""Read properties from the section node"""
|
||||||
super().ReadNode()
|
super().ReadNode()
|
||||||
@@ -195,7 +206,7 @@ class Entry_section(Entry):
|
|||||||
|
|
||||||
def ReadEntries(self):
|
def ReadEntries(self):
|
||||||
for node in self._node.subnodes:
|
for node in self._node.subnodes:
|
||||||
if node.name.startswith('hash') or node.name.startswith('signature'):
|
if self.IsSpecialSubnode(node):
|
||||||
continue
|
continue
|
||||||
entry = Entry.Create(self, node,
|
entry = Entry.Create(self, node,
|
||||||
expanded=self.GetImage().use_expanded,
|
expanded=self.GetImage().use_expanded,
|
||||||
|
Reference in New Issue
Block a user