contrib/gcc-changelog: Handle Reviewed-{by,on}

Message ID xu8fsgfwuul5.fsf@harwath.name
State New
Headers show
Series
  • contrib/gcc-changelog: Handle Reviewed-{by,on}
Related show

Commit Message

Frederik Harwath May 19, 2020, 9:45 a.m.
Hi,
the new contrib/gcc-changelog/git_check_commit.py script
(which, by the way, is very useful!) does not handle "Reviewed-by" and
"Reviewed-on" lines yet and hence it expects those lines to be indented
by a tab although those lines are usually not indented. The script
already knows about "Co-Authored-By" lines and I have extended it to
handle the "Reviewed-{by,on}" lines in a similar way. The information
from those lines is not processed further since the review information
apparantly does not get included in the ChangeLogs.

Ok to commit the patch?

Best regards,
Frederik
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter

Comments

Martin Liška May 19, 2020, 9:49 a.m. | #1
On 5/19/20 11:45 AM, Frederik Harwath wrote:
> Hi,

> the new contrib/gcc-changelog/git_check_commit.py script

> (which, by the way, is very useful!) does not handle "Reviewed-by" and

> "Reviewed-on" lines yet and hence it expects those lines to be indented

> by a tab although those lines are usually not indented. The script

> already knows about "Co-Authored-By" lines and I have extended it to

> handle the "Reviewed-{by,on}" lines in a similar way. The information

> from those lines is not processed further since the review information

> apparantly does not get included in the ChangeLogs.


Thank you Frederick for the patch.

Looking at what I grepped:
https://github.com/marxin/gcc-changelog/issues/1#issuecomment-621910248

Can you also add 'Signed-off-by'? And please create a list with these
exceptions at the beginning of the script.

Fine with that.
Martin

> 

> Ok to commit the patch?

> 

> Best regards,

> Frederik

> -----------------

> Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany

> Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter

>
Frederik Harwath May 20, 2020, 5:53 a.m. | #2
Martin Liška <mliska@suse.cz> writes:

Hi Martin,

> On 5/19/20 11:45 AM, Frederik Harwath wrote:

> Thank you Frederick for the patch.

>

> Looking at what I grepped:

> https://github.com/marxin/gcc-changelog/issues/1#issuecomment-621910248


I get a 404 error when I try to access this URL. The repository also
does not seem to be in your list of public repositories.


> Can you also add 'Signed-off-by'? And please create a list with these

> exceptions at the beginning of the script.


Yes, I will add it.

> Fine with that.


Best regards,
Frederik
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter
Martin Liška May 20, 2020, 8:07 a.m. | #3
On 5/20/20 7:53 AM, Frederik Harwath wrote:
> Martin Liška <mliska@suse.cz> writes:

> 

> Hi Martin,

> 

>> On 5/19/20 11:45 AM, Frederik Harwath wrote:

>> Thank you Frederick for the patch.

>>

>> Looking at what I grepped:

>> https://github.com/marxin/gcc-changelog/issues/1#issuecomment-621910248

> 

> I get a 404 error when I try to access this URL. The repository also

> does not seem to be in your list of public repositories.


Ah, sorry. It was intentional as all pieces of the gcc-changelog project were
moved to GCC.

The mentioned list:
patches/0289-Fix-expectation-and-types-in-acc_get_property-tests.patch:Reviewed-by: Thomas Schwinge  <thomas@codesourcery.com>
patches/0419-Add-acc_device_radeon-to-name_of_acc_device_t-functi.patch:Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>
patches/0713-arc-Don-t-use-if-conversion-when-optimizing-for-size.patch:Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
patches/0969-PPC64-fix-documentation-for-__builtin_crypto_vpmsum-.patch:Signed-off-by: Carl Love <carll@us.ibm.com>
patches/1082-arc-Update-legitimate-small-data-address.patch:Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
patches/1160-arc-Update-tumaddsidi4-test.patch:Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
patches/1327-dwarf-Generate-DIEs-for-external-variables-with-g1-9.patch:Signed-off-by: Alexey Neyman <stilor@att.net>
patches/1937-Remove-fishy-self-assignment-in-omp-low.c-PR94629.patch:Reviewed-by: Thomas Schwinge  <thomas@codesourcery.com>
patches/2008-OpenACC-Avoid-ICE-in-type-cast-async-wait-clauses.patch:Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>

Martin

> 

> 

>> Can you also add 'Signed-off-by'? And please create a list with these

>> exceptions at the beginning of the script.

> 

> Yes, I will add it.

> 

>> Fine with that.

> 

> Best regards,

> Frederik

> -----------------

> Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany

> Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter

>
Martin Liška May 20, 2020, 9:05 a.m. | #4
On 5/20/20 7:53 AM, Frederik Harwath wrote:
> Yes, I will add it.


Thank you for the patch. I'm adding test for that and also
some format changes in order to make flake8 happy:

flake8 contrib/gcc-changelog/
contrib/gcc-changelog/git_commit.py:158:59: E502 the backslash is redundant between brackets
contrib/gcc-changelog/git_commit.py:161:1: E302 expected 2 blank lines, found 1
contrib/gcc-changelog/git_commit.py:354:17: E303 too many blank lines (2)

Thank you,
Martin
From 7927147ae57e7394e479d368faf166149470a018 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>

Date: Wed, 20 May 2020 11:02:41 +0200
Subject: [PATCH] git_commit.py: Add tests for signatures.

contrib/ChangeLog:

2020-05-20  Martin Liska  <mliska@suse.cz>

	* gcc-changelog/git_commit.py: Refactor to make flake8 happy.
	* gcc-changelog/test_email.py: Add new test.
	* gcc-changelog/test_patches.txt: Add new patch.
---
 contrib/gcc-changelog/git_commit.py    |  4 +--
 contrib/gcc-changelog/test_email.py    |  5 ++++
 contrib/gcc-changelog/test_patches.txt | 34 ++++++++++++++++++++++++++
 3 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py
index c9b849706c4..e4903cac4ef 100755
--- a/contrib/gcc-changelog/git_commit.py
+++ b/contrib/gcc-changelog/git_commit.py
@@ -155,9 +155,10 @@ REVIEWED_BY_PREFIX = 'reviewed-by: '
 REVIEWED_ON_PREFIX = 'reviewed-on: '
 SIGNED_OFF_BY_PREFIX = 'signed-off-by: '
 
-REVIEW_PREFIXES = (REVIEWED_BY_PREFIX, REVIEWED_ON_PREFIX,\
+REVIEW_PREFIXES = (REVIEWED_BY_PREFIX, REVIEWED_ON_PREFIX,
                    SIGNED_OFF_BY_PREFIX)
 
+
 class Error:
     def __init__(self, message, line=None):
         self.message = message
@@ -350,7 +351,6 @@ class GitCommit:
                     else:
                         pr_line = line.lstrip()
 
-
                 lowered_line = line.lower()
                 if lowered_line.startswith(CO_AUTHORED_BY_PREFIX):
                     name = line[len(CO_AUTHORED_BY_PREFIX):]
diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py
index 5e99d3240e8..92bcb89ed8b 100755
--- a/contrib/gcc-changelog/test_email.py
+++ b/contrib/gcc-changelog/test_email.py
@@ -262,3 +262,8 @@ class TestGccChangelog(unittest.TestCase):
     def test_cherry_pick_format(self):
         email = self.from_patch_glob('0001-c-Alias.patch')
         assert not email.errors
+
+    def test_signatures(self):
+        email = self.from_patch_glob('0001-RISC-V-Make-unique.patch')
+        assert not email.errors
+        assert len(email.changelog_entries) == 1
diff --git a/contrib/gcc-changelog/test_patches.txt b/contrib/gcc-changelog/test_patches.txt
index ec667be9a92..7a78c4de897 100644
--- a/contrib/gcc-changelog/test_patches.txt
+++ b/contrib/gcc-changelog/test_patches.txt
@@ -2410,4 +2410,38 @@ index b8f03d18541..7230ac724ba 100644
 +
 -- 
 2.26.2
+=== 0001-RISC-V-Make-unique.patch ===
+From adce62f53d8ad00e8110a6a2de7962d7a850de16 Mon Sep 17 00:00:00 2001
+From: Keith Packard <keithp@keithp.com>
+Date: Wed, 29 Apr 2020 09:49:56 -0700
+Subject: [PATCH] RISC-V: Make unique SECCAT_SRODATA names start with .srodata
+ (not .sdata2)
+
+default_unique_section uses ".sdata2" as a prefix for SECCAT_SRODATA
+unique sections, but RISC-V uses ".srodata" instead. Override the
+TARGET_ASM_UNIQUE_SECTION function to catch this case, allowing the
+default to be used for all other sections.
 
+gcc/
+	* config/riscv/riscv.c (riscv_unique_section): New.
+	(TARGET_ASM_UNIQUE_SECTION): New.
+
+Signed-off-by: Keith Packard <keithp@keithp.com>
+Reviewed-by: Keith Packard <keithp@keithp.com>
+Reviewed-on: Keith Packard <keithp@keithp.com>
+Co-Authored-by: Keith Packard <keithp@keithp.com>
+---
+ gcc/ChangeLog            |  5 +++++
+ gcc/config/riscv/riscv.c | 40 ++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 45 insertions(+)
+
+diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c
+index e4c08d780db..1ad9799fce4 100644
+--- a/gcc/config/riscv/riscv.c
++++ b/gcc/config/riscv/riscv.c
+@@ -1 +1,2 @@
+
++
+
+-- 
+2.26.2
-- 
2.26.2

Patch

From 0dc9b201bc1607de36cb9b3604a87cc3646292e3 Mon Sep 17 00:00:00 2001
From: Frederik Harwath <frederik@codesourcery.com>
Date: Tue, 19 May 2020 11:15:28 +0200
Subject: [PATCH] contrib/gcc-changelog: Handle Reviewed-{by,on}

git-check-commit.py does not know about "Reviewed-by" and
"Reviewed-on" lines and hence it expects those lines which
follow the ChangeLog entries to be indented by a tab.

This commit makes the script skip those lines.  No further
processing is attempted because the review information
is not part of the ChangeLogs.

contrib/

2020-05-19  Frederik Harwath  <frederik@codesourcery.com>

	* gcc-changelog/git_commit.py: Skip over lines starting
	with "Reviewed-by: " or "Reviewed-on: ".
---
 contrib/gcc-changelog/git_commit.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py
index 5214cc36538..ebcf853f02f 100755
--- a/contrib/gcc-changelog/git_commit.py
+++ b/contrib/gcc-changelog/git_commit.py
@@ -150,6 +150,8 @@  star_prefix_regex = re.compile(r'\t\*(?P<spaces>\ *)(?P<content>.*)')
 LINE_LIMIT = 100
 TAB_WIDTH = 8
 CO_AUTHORED_BY_PREFIX = 'co-authored-by: '
+REVIEWED_BY_PREFIX = 'reviewed-by: '
+REVIEWED_ON_PREFIX = 'reviewed-on: '
 
 
 class Error:
@@ -344,12 +346,19 @@  class GitCommit:
                     else:
                         pr_line = line.lstrip()
 
-                if line.lower().startswith(CO_AUTHORED_BY_PREFIX):
+                lowered_line = line.lower()
+                if lowered_line.startswith(CO_AUTHORED_BY_PREFIX):
                     name = line[len(CO_AUTHORED_BY_PREFIX):]
                     author = self.format_git_author(name)
                     self.co_authors.append(author)
                     continue
 
+                # Skip over review information for now.
+                # This avoids errors due to missing tabs on these lines below.
+                if lowered_line.startswith((REVIEWED_BY_PREFIX,\
+                                            REVIEWED_ON_PREFIX)):
+                    continue
+
                 # ChangeLog name will be deduced later
                 if not last_entry:
                     if author_tuple:
-- 
2.17.1