All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/3] tools: patman: Handle tag sections without an 'END'
@ 2016-06-24 14:45 Bin Meng
  2016-06-24 14:45 ` [U-Boot] [PATCH 2/3] tools: patman: Handle missing 'END' for 'Cover-letter' Bin Meng
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Bin Meng @ 2016-06-24 14:45 UTC (permalink / raw)
  To: u-boot

'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@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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH 2/3] tools: patman: Handle missing 'END' for 'Cover-letter'
  2016-06-24 14:45 [U-Boot] [PATCH 1/3] tools: patman: Handle tag sections without an 'END' Bin Meng
@ 2016-06-24 14:45 ` Bin Meng
  2016-06-26  2:54   ` Simon Glass
  2016-06-24 14:45 ` [U-Boot] [PATCH 3/3] tools: patman: Handle missing blank line for 'Series-changes' Bin Meng
  2016-06-26  2:54 ` [U-Boot] [PATCH 1/3] tools: patman: Handle tag sections without an 'END' Simon Glass
  2 siblings, 1 reply; 6+ messages in thread
From: Bin Meng @ 2016-06-24 14:45 UTC (permalink / raw)
  To: u-boot

If 'END' is missing in a 'Cover-letter' section, and that section
happens to show up at the very end of the commit message, patman
fails to generate cover letter for us. Handle this in CloseCommit
of patchstream.

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

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

diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
index eeeb5ea..5573326 100644
--- a/tools/patman/patchstream.py
+++ b/tools/patman/patchstream.py
@@ -112,6 +112,11 @@ class PatchStream:
         if self.commit and self.is_log:
             self.series.AddCommit(self.commit)
             self.commit = None
+        # If 'END' is missing in a 'Cover-letter' section, and that section
+        # happens to show up at the very end of the commit message, this is
+        # the chance for us to fix it up.
+        if self.in_section == 'cover' and self.is_log:
+            self.series.cover = self.section
 
     def ProcessLine(self, line):
         """Process a single line of a patch file or commit log
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH 3/3] tools: patman: Handle missing blank line for 'Series-changes'
  2016-06-24 14:45 [U-Boot] [PATCH 1/3] tools: patman: Handle tag sections without an 'END' Bin Meng
  2016-06-24 14:45 ` [U-Boot] [PATCH 2/3] tools: patman: Handle missing 'END' for 'Cover-letter' Bin Meng
@ 2016-06-24 14:45 ` Bin Meng
  2016-06-26  2:54   ` Simon Glass
  2016-06-26  2:54 ` [U-Boot] [PATCH 1/3] tools: patman: Handle tag sections without an 'END' Simon Glass
  2 siblings, 1 reply; 6+ messages in thread
From: Bin Meng @ 2016-06-24 14:45 UTC (permalink / raw)
  To: u-boot

'Series-changes' uses blank line to indicate its end. If that is
missing, series internal state variable 'in_change' may be wrong.
Correct its state.

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

 tools/patman/patchstream.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
index 5573326..338b581 100644
--- a/tools/patman/patchstream.py
+++ b/tools/patman/patchstream.py
@@ -173,10 +173,10 @@ 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 a tag is detected, but we are already in a section,
+            # this means 'END' is missing for that section, fix it up.
             if self.in_section:
                 if self.in_section == 'cover':
                     self.series.cover = self.section
@@ -191,6 +191,10 @@ class PatchStream:
                 self.in_section = None
                 self.skip_blank = True
                 self.section = []
+            # If a tag is detected, but we are already in a change list,
+            # that means a blank line is missing, fix it up.
+            if self.in_change:
+                self.in_change = 0
 
         # If we are in a section, keep collecting lines until we see END
         if self.in_section:
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH 1/3] tools: patman: Handle tag sections without an 'END'
  2016-06-24 14:45 [U-Boot] [PATCH 1/3] tools: patman: Handle tag sections without an 'END' Bin Meng
  2016-06-24 14:45 ` [U-Boot] [PATCH 2/3] tools: patman: Handle missing 'END' for 'Cover-letter' Bin Meng
  2016-06-24 14:45 ` [U-Boot] [PATCH 3/3] tools: patman: Handle missing blank line for 'Series-changes' Bin Meng
@ 2016-06-26  2:54 ` Simon Glass
  2 siblings, 0 replies; 6+ messages in thread
From: Simon Glass @ 2016-06-26  2:54 UTC (permalink / raw)
  To: u-boot

On 24 June 2016 at 08:45, Bin Meng <bmeng.cn@gmail.com> wrote:
> '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@gmail.com>
> ---
>
>  tools/patman/patchstream.py | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)

Great!

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH 2/3] tools: patman: Handle missing 'END' for 'Cover-letter'
  2016-06-24 14:45 ` [U-Boot] [PATCH 2/3] tools: patman: Handle missing 'END' for 'Cover-letter' Bin Meng
@ 2016-06-26  2:54   ` Simon Glass
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Glass @ 2016-06-26  2:54 UTC (permalink / raw)
  To: u-boot

On 24 June 2016 at 08:45, Bin Meng <bmeng.cn@gmail.com> wrote:
> If 'END' is missing in a 'Cover-letter' section, and that section
> happens to show up at the very end of the commit message, patman
> fails to generate cover letter for us. Handle this in CloseCommit
> of patchstream.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  tools/patman/patchstream.py | 5 +++++
>  1 file changed, 5 insertions(+)

Acked-by: Simon Glass <sjg@chromium.org>

Can we generate a warning here?

>
> diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
> index eeeb5ea..5573326 100644
> --- a/tools/patman/patchstream.py
> +++ b/tools/patman/patchstream.py
> @@ -112,6 +112,11 @@ class PatchStream:
>          if self.commit and self.is_log:
>              self.series.AddCommit(self.commit)
>              self.commit = None
> +        # If 'END' is missing in a 'Cover-letter' section, and that section
> +        # happens to show up at the very end of the commit message, this is
> +        # the chance for us to fix it up.
> +        if self.in_section == 'cover' and self.is_log:
> +            self.series.cover = self.section
>
>      def ProcessLine(self, line):
>          """Process a single line of a patch file or commit log
> --
> 2.7.4
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH 3/3] tools: patman: Handle missing blank line for 'Series-changes'
  2016-06-24 14:45 ` [U-Boot] [PATCH 3/3] tools: patman: Handle missing blank line for 'Series-changes' Bin Meng
@ 2016-06-26  2:54   ` Simon Glass
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Glass @ 2016-06-26  2:54 UTC (permalink / raw)
  To: u-boot

On 24 June 2016 at 08:45, Bin Meng <bmeng.cn@gmail.com> wrote:
> 'Series-changes' uses blank line to indicate its end. If that is
> missing, series internal state variable 'in_change' may be wrong.
> Correct its state.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  tools/patman/patchstream.py | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

Can we have a warning too?

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-06-26  2:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-24 14:45 [U-Boot] [PATCH 1/3] tools: patman: Handle tag sections without an 'END' Bin Meng
2016-06-24 14:45 ` [U-Boot] [PATCH 2/3] tools: patman: Handle missing 'END' for 'Cover-letter' Bin Meng
2016-06-26  2:54   ` Simon Glass
2016-06-24 14:45 ` [U-Boot] [PATCH 3/3] tools: patman: Handle missing blank line for 'Series-changes' Bin Meng
2016-06-26  2:54   ` Simon Glass
2016-06-26  2:54 ` [U-Boot] [PATCH 1/3] tools: patman: Handle tag sections without an 'END' Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.