[U-Boot] [PATCH 1/3] tools: patman: Handle tag sections without an 'END'

Bin Meng bmeng.cn at gmail.com
Fri Jun 24 16:45:19 CEST 2016


'Cover-letter', 'Series-notes' and 'Commit-notes' tags require an
'END' to be put at the end of its section. When 'END' is missing,
patman generates incorrect patches. This adds codes to handle such
scenario.

Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
---

 tools/patman/patchstream.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
index 27d031e..eeeb5ea 100644
--- a/tools/patman/patchstream.py
+++ b/tools/patman/patchstream.py
@@ -168,6 +168,25 @@ class PatchStream:
         elif commit_match:
             self.state = STATE_MSG_HEADER
 
+        # If a tag is detected, but we are already in a section,
+        # this means 'END' is missing for that section, fix it up.
+        if series_tag_match or commit_tag_match or \
+           cover_cc_match or signoff_match:
+            if self.in_section:
+                if self.in_section == 'cover':
+                    self.series.cover = self.section
+                elif self.in_section == 'notes':
+                    if self.is_log:
+                        self.series.notes += self.section
+                elif self.in_section == 'commit-notes':
+                    if self.is_log:
+                        self.commit.notes += self.section
+                else:
+                    self.warn.append("Unknown section '%s'" % self.in_section)
+                self.in_section = None
+                self.skip_blank = True
+                self.section = []
+
         # If we are in a section, keep collecting lines until we see END
         if self.in_section:
             if line == 'END':
-- 
2.7.4



More information about the U-Boot mailing list