]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
binman: Move sort and expand to the main Pack() function
authorSimon Glass <sjg@chromium.org>
Mon, 26 Oct 2020 23:40:19 +0000 (17:40 -0600)
committerSimon Glass <sjg@chromium.org>
Thu, 29 Oct 2020 20:42:59 +0000 (14:42 -0600)
At present sorting and expanding entries are side-effects of the
CheckEntries() function. This is a bit confusing, as 'checking' would
not normally involve making changes.

Move these steps into the Pack() function instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/binman/etype/section.py

index fb4bf640bfb394e493b69e5296e0fc0d9dc496e0..c883f0d67c4438159290639de476624d1042f547 100644 (file)
@@ -260,6 +260,10 @@ class Entry_section(Entry):
     def Pack(self, offset):
         """Pack all entries into the section"""
         self._PackEntries()
+        if self._sort:
+            self._SortEntries()
+        self._ExpandEntries()
+
         return super().Pack(offset)
 
     def _PackEntries(self):
@@ -290,9 +294,6 @@ class Entry_section(Entry):
 
     def CheckEntries(self):
         """Check that entries do not overlap or extend outside the section"""
-        if self._sort:
-            self._SortEntries()
-        self._ExpandEntries()
         offset = 0
         prev_name = 'None'
         for entry in self._entries.values():