_entries, as highlighted by leading _, is a private member and thus should not be accessed directly. As a result use the GetEntries function instead. GetEntries() returns _entries. No functional change introduced in this commit.
Signed-off-by: Yannic Moog <y.m...@phytec.de> --- tools/binman/etype/atf_fip.py | 4 ++-- tools/binman/etype/blob_phase.py | 4 ++-- tools/binman/etype/cbfs.py | 12 +++++----- tools/binman/etype/efi_capsule.py | 2 +- tools/binman/etype/fit.py | 4 ++-- tools/binman/etype/mkimage.py | 4 ++-- tools/binman/etype/nxp_imx8mcst.py | 2 +- tools/binman/etype/nxp_imx8mimage.py | 2 +- tools/binman/etype/section.py | 44 +++++++++++++++++------------------ tools/binman/etype/ti_board_config.py | 8 +++---- tools/binman/ftest.py | 2 +- 11 files changed, 44 insertions(+), 44 deletions(-) diff --git a/tools/binman/etype/atf_fip.py b/tools/binman/etype/atf_fip.py index 636e073afc84b37d64934e6dd03945e9d515483a..56c5b2a8189453d83dd48fd37416690ded140f2a 100644 --- a/tools/binman/etype/atf_fip.py +++ b/tools/binman/etype/atf_fip.py @@ -220,7 +220,7 @@ class Entry_atf_fip(Entry_section): bytes: Data obtained, or None if None """ fip = FipWriter(self._fip_flags, self._fip_align) - for entry in self._entries.values(): + for entry in self.GetEntries().values(): # First get the input data and put it in an entry. If not available, # try later. entry_data = entry.GetData(required) @@ -244,7 +244,7 @@ class Entry_atf_fip(Entry_section): super().SetImagePos(image_pos) # Now update the entries with info from the FIP entries - for entry in self._entries.values(): + for entry in self.GetEntries().values(): fent = entry._fip_entry entry.size = fent.size entry.offset = fent.offset diff --git a/tools/binman/etype/blob_phase.py b/tools/binman/etype/blob_phase.py index 09bb89b3b7849834c3572f4c8080ce0fdcca1dc2..0f9ab3f05dd19baecb052ab8b3af513ecca15936 100644 --- a/tools/binman/etype/blob_phase.py +++ b/tools/binman/etype/blob_phase.py @@ -55,10 +55,10 @@ class Entry_blob_phase(Entry_section): # Propagate the no-write-symbols property if self.no_write_symbols: - for entry in self._entries.values(): + for entry in self.GetEntries().values(): entry.no_write_symbols = True # Propagate the symbols-base property if self.symbols_base is not None: - for entry in self._entries.values(): + for entry in self.GetEntries().values(): entry.symbols_base = self.symbols_base diff --git a/tools/binman/etype/cbfs.py b/tools/binman/etype/cbfs.py index 124fa1e4ffc7d0374b27c09d32ead8429567d304..886e34ef8221ad50e9f881e8abad16015c9790b5 100644 --- a/tools/binman/etype/cbfs.py +++ b/tools/binman/etype/cbfs.py @@ -220,7 +220,7 @@ class Entry_cbfs(Entry): if self.size is None: self.Raise("'cbfs' entry must have a size property") cbfs = CbfsWriter(self.size, arch) - for entry in self._entries.values(): + for entry in self.GetEntries().values(): if entry != skip_entry and not entry.ObtainContents(): return False cfile = self.ObtainCfile(cbfs, entry) @@ -241,7 +241,7 @@ class Entry_cbfs(Entry): super().SetImagePos(image_pos) # Now update the entries with info from the CBFS entries - for entry in self._entries.values(): + for entry in self.GetEntries().values(): cfile = entry._cbfs_file entry.size = cfile.data_len entry.offset = cfile.calced_cbfs_offset @@ -251,7 +251,7 @@ class Entry_cbfs(Entry): def AddMissingProperties(self, have_image_pos): super().AddMissingProperties(have_image_pos) - for entry in self._entries.values(): + for entry in self.GetEntries().values(): entry.AddMissingProperties(have_image_pos) if entry._cbfs_compress: state.AddZeroProp(entry._node, 'uncomp-size') @@ -263,7 +263,7 @@ class Entry_cbfs(Entry): def SetCalculatedProperties(self): """Set the value of device-tree properties calculated by binman""" super().SetCalculatedProperties() - for entry in self._entries.values(): + for entry in self.GetEntries().values(): state.SetInt(entry._node, 'offset', entry.offset) state.SetInt(entry._node, 'size', entry.size) state.SetInt(entry._node, 'image-pos', entry.image_pos) @@ -273,7 +273,7 @@ class Entry_cbfs(Entry): def ListEntries(self, entries, indent): """Override this method to list all files in the section""" super().ListEntries(entries, indent) - for entry in self._entries.values(): + for entry in self.GetEntries().values(): entry.ListEntries(entries, indent + 1) def GetEntries(self): @@ -299,5 +299,5 @@ class Entry_cbfs(Entry): def AddBintools(self, btools): super().AddBintools(btools) - for entry in self._entries.values(): + for entry in self.GetEntries().values(): entry.AddBintools(btools) diff --git a/tools/binman/etype/efi_capsule.py b/tools/binman/etype/efi_capsule.py index 9f06cc88e6e505448800c05988a039d287525b7b..5cdc6536795b824aea74b22b198a177df8cb35e2 100644 --- a/tools/binman/etype/efi_capsule.py +++ b/tools/binman/etype/efi_capsule.py @@ -130,7 +130,7 @@ class Entry_efi_capsule(Entry_section): if not os.path.isabs(self.public_key_cert): public_key_cert = tools.get_input_filename(self.public_key_cert) data, payload, uniq = self.collect_contents_to_file( - self._entries.values(), 'capsule_in') + self.GetEntries().values(), 'capsule_in') outfile = self._filename if self._filename else 'capsule.%s' % uniq capsule_fname = tools.get_output_filename(outfile) guid = self.image_guid diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py index ed3cac4ee7e9706bc46f1cffc90c41946591ec2f..f03e64319eeb3c23b59e368bfac698765e68e1b5 100644 --- a/tools/binman/etype/fit.py +++ b/tools/binman/etype/fit.py @@ -962,7 +962,7 @@ class Entry_fit(Entry_section): # Remove generator entries from the main list for path in to_remove: - if path in self._entries: + if path in self.GetEntries(): del self._entries[path] # Pack this new FDT and scan it so we can add the data later @@ -994,7 +994,7 @@ class Entry_fit(Entry_section): fdt = Fdt.FromData(self.GetData()) fdt.Scan() - for image_name, entry in self._entries.items(): + for image_name, entry in self.GetEntries().items(): path = f"/images/{image_name}" node = fdt.GetNode(path) diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py index 6ae5d0c8a4f3c54e1277a575b8e235cc1aba4e13..19ee30a13ca75a5d05a17d4c26424e84934b6ea2 100644 --- a/tools/binman/etype/mkimage.py +++ b/tools/binman/etype/mkimage.py @@ -168,7 +168,7 @@ class Entry_mkimage(Entry_section): if self._multiple_data_files: fnames = [] uniq = self.GetUniqueName() - for entry in self._entries.values(): + for entry in self.GetEntries().values(): # Put the contents in a temporary file ename = f'mkimage-in-{uniq}-{entry.name}' fname = tools.get_output_filename(ename) @@ -179,7 +179,7 @@ class Entry_mkimage(Entry_section): data = b'' else: data, input_fname, uniq = self.collect_contents_to_file( - self._entries.values(), 'mkimage', fake_size) + self.GetEntries().values(), 'mkimage', fake_size) if self._imagename: image_data, imagename_fname, _ = self.collect_contents_to_file( [self._imagename], 'mkimage-n', 1024) diff --git a/tools/binman/etype/nxp_imx8mcst.py b/tools/binman/etype/nxp_imx8mcst.py index dd9f226b7514ff4070652273c5520498bec02f90..8b3785a318bcc4c92c3ac0ed23b745f08911e4fb 100644 --- a/tools/binman/etype/nxp_imx8mcst.py +++ b/tools/binman/etype/nxp_imx8mcst.py @@ -95,7 +95,7 @@ class Entry_nxp_imx8mcst(Entry_mkimage): def BuildSectionData(self, required): data, input_fname, uniq = self.collect_contents_to_file( - self._entries.values(), 'input') + self.GetEntries().values(), 'input') # Parse the input data and figure out what it is that is being signed. # - If it is mkimage'd imx8mimage, then extract to be signed data size diff --git a/tools/binman/etype/nxp_imx8mimage.py b/tools/binman/etype/nxp_imx8mimage.py index 8ad177b3b65e8c45e7f2fd74768b319930704e10..2fc572f2dc09a40b8e255d6157de31f806649e7d 100644 --- a/tools/binman/etype/nxp_imx8mimage.py +++ b/tools/binman/etype/nxp_imx8mimage.py @@ -39,7 +39,7 @@ class Entry_nxp_imx8mimage(Entry_mkimage): def BuildSectionData(self, required): data, input_fname, uniq = self.collect_contents_to_file( - self._entries.values(), 'input') + self.GetEntries().values(), 'input') # Generate mkimage configuration file similar to imx8mimage.cfg # and pass it to mkimage to generate SPL image for us here. cfg_fname = tools.get_output_filename('nxp.imx8mimage.cfg.%s' % uniq) diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py index 4c4c8c417f81be6fc1e23d28ea971052e7aef9c9..44b1b85e93496d0ca114907f42a98da1f0af09b9 100644 --- a/tools/binman/etype/section.py +++ b/tools/binman/etype/section.py @@ -229,7 +229,7 @@ class Entry_section(Entry): def GetFdts(self): fdts = {} - for entry in self._entries.values(): + for entry in self.GetEntries().values(): fdts.update(entry.GetFdts()) return fdts @@ -239,7 +239,7 @@ class Entry_section(Entry): Some entries need to adjust the device tree for their purposes. This may involve adding or deleting properties. """ - todo = self._entries.values() + todo = self.GetEntries().values() for passnum in range(3): next_todo = [] for entry in todo: @@ -255,7 +255,7 @@ class Entry_section(Entry): def gen_entries(self): super().gen_entries() - for entry in self._entries.values(): + for entry in self.GetEntries().values(): entry.gen_entries() def AddMissingProperties(self, have_image_pos): @@ -263,7 +263,7 @@ class Entry_section(Entry): super().AddMissingProperties(have_image_pos) if self.compress != 'none': have_image_pos = False - for entry in self._entries.values(): + for entry in self.GetEntries().values(): entry.AddMissingProperties(have_image_pos) def ObtainContents(self, fake_size=0, skip_entry=None): @@ -329,7 +329,7 @@ class Entry_section(Entry): """ section_data = bytearray() - for entry in self._entries.values(): + for entry in self.GetEntries().values(): entry_data = entry.GetData(required) # This can happen when this section is referenced from a collection @@ -364,7 +364,7 @@ class Entry_section(Entry): section_data += data self.Detail('GetData: %d entries, total size %#x' % - (len(self._entries), len(section_data))) + (len(self.GetEntries()), len(section_data))) return self.CompressData(section_data) def GetPaddedData(self, data=None): @@ -425,7 +425,7 @@ class Entry_section(Entry): def ResetForPack(self): """Reset offset/size fields so that packing can be done again""" super().ResetForPack() - for entry in self._entries.values(): + for entry in self.GetEntries().values(): entry.ResetForPack() def Pack(self, offset): @@ -457,7 +457,7 @@ class Entry_section(Entry): def _extend_entries(self): """Extend any entries that are permitted to""" exp_entry = None - for entry in self._entries.values(): + for entry in self.GetEntries().values(): if exp_entry: exp_entry.extend_to_limit(entry.offset) exp_entry = None @@ -468,8 +468,8 @@ class Entry_section(Entry): def _SortEntries(self): """Sort entries by offset""" - entries = sorted(self._entries.values(), key=lambda entry: entry.offset) - self._entries.clear() + entries = sorted(self.GetEntries().values(), key=lambda entry: entry.offset) + self.GetEntries().clear() for entry in entries: self._entries[entry._node.name] = entry @@ -479,7 +479,7 @@ class Entry_section(Entry): offset = 0 prev_name = 'None' - for entry in self._entries.values(): + for entry in self.GetEntries().values(): entry.CheckEntries() if (entry.offset < self._skip_at_start or entry.offset + entry.size > self._skip_at_start + @@ -500,24 +500,24 @@ class Entry_section(Entry): def WriteSymbols(self, section): """Write symbol values into binary files for access at run time""" - for entry in self._entries.values(): + for entry in self.GetEntries().values(): entry.WriteSymbols(self) def SetCalculatedProperties(self): super().SetCalculatedProperties() - for entry in self._entries.values(): + for entry in self.GetEntries().values(): entry.SetCalculatedProperties() def SetImagePos(self, image_pos): super().SetImagePos(image_pos) if self.compress == 'none': - for entry in self._entries.values(): + for entry in self.GetEntries().values(): entry.SetImagePos(image_pos + self.offset) def ProcessContents(self): sizes_ok_base = super(Entry_section, self).ProcessContents() sizes_ok = True - for entry in self._entries.values(): + for entry in self.GetEntries().values(): if not entry.ProcessContents(): sizes_ok = False return sizes_ok and sizes_ok_base @@ -530,7 +530,7 @@ class Entry_section(Entry): """ Entry.WriteMapLine(fd, indent, self.name, self.offset or 0, self.size, self.image_pos) - for entry in self._entries.values(): + for entry in self.GetEntries().values(): entry.WriteMap(fd, indent + 1) def GetEntries(self): @@ -641,7 +641,7 @@ class Entry_section(Entry): property which is not supported """ if not entries: - entries = self._entries + entries = self.GetEntries() entry, entry_name, prop_name = self.LookupEntry(entries, sym_name, msg) if not entry: err = ("%s: Entry '%s' not found in list (%s)" % @@ -687,7 +687,7 @@ class Entry_section(Entry): Returns: entry matching that type, or None if not found """ - for entry in self._entries.values(): + for entry in self.GetEntries().values(): if entry.etype == etype: return entry return None @@ -780,7 +780,7 @@ class Entry_section(Entry): offset: New offset, or None to leave alone size: New size, or None to leave alone """ - entry = self._entries.get(name) + entry = self.GetEntries().get(name) if not entry: self._Raise("Unable to set offset/size for unknown entry '%s'" % name) @@ -793,7 +793,7 @@ class Entry_section(Entry): This calls each entry's GetOffsets() method. If it returns a list of entries to update, it updates them. """ - for entry in self._entries.values(): + for entry in self.GetEntries().values(): offset_dict = entry.GetOffsets() for name, info in offset_dict.items(): self._SetEntryOffsetSize(name, *info) @@ -822,11 +822,11 @@ class Entry_section(Entry): """List the files in the section""" Entry.AddEntryInfo(entries, indent, self.name, self.etype, self.size, self.image_pos, None, self.offset, self) - for entry in self._entries.values(): + for entry in self.GetEntries().values(): entry.ListEntries(entries, indent + 1) def LoadData(self, decomp=True): - for entry in self._entries.values(): + for entry in self.GetEntries().values(): entry.LoadData(decomp) data = self.ReadData(decomp) self.contents_size = len(data) diff --git a/tools/binman/etype/ti_board_config.py b/tools/binman/etype/ti_board_config.py index 7c6773ac7bcd2780b5bbe7b3cd6d7d62b38dfe77..a78c7ba14561072ff64ad64ebcbcbbe95d074859 100644 --- a/tools/binman/etype/ti_board_config.py +++ b/tools/binman/etype/ti_board_config.py @@ -227,16 +227,16 @@ class Entry_ti_board_config(Entry_section): self._binary_offset += t_bytes self._binary_offset += self._num_elems * struct.calcsize(self._fmt) - if 'board-cfg' in self._entries: + if 'board-cfg' in self.GetEntries(): self._add_boardcfg(BOARDCFG, self._entries['board-cfg']._cfg_data) - if 'sec-cfg' in self._entries: + if 'sec-cfg' in self.GetEntries(): self._add_boardcfg(BOARDCFG_SEC, self._entries['sec-cfg']._cfg_data) - if 'pm-cfg' in self._entries: + if 'pm-cfg' in self.GetEntries(): self._add_boardcfg(BOARDCFG_PM, self._entries['pm-cfg']._cfg_data) - if 'rm-cfg' in self._entries: + if 'rm-cfg' in self.GetEntries(): self._add_boardcfg(BOARDCFG_RM, self._entries['rm-cfg']._cfg_data) data = self._finalize() diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 52f0a729bdab0a0bd00f798bbc07d678dd4513de..3fccd4c8ef5f8757b54f3b3fe5fe7898fd166dcb 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -2198,7 +2198,7 @@ class TestFunctional(unittest.TestCase): image = control.images['image'] entries = image.GetEntries() files = entries['files'] - entries = files._entries + entries = files.GetEntries() orig = b'' for i in range(1, 3): -- 2.43.0