From: "Martin Liška" <mliska@suse.cz>
To: Jonathan Wakely <jwakely.gcc@gmail.com>,
Gerald Pfeifer <gerald@pfeifer.com>
Cc: Jakub Jelinek <jakub@redhat.com>,
"gcc@gcc.gnu.org" <gcc@gcc.gnu.org>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [IMPORTANT] ChangeLog related changes
Date: Tue, 2 Jun 2020 15:16:13 +0200 [thread overview]
Message-ID: <f5e6d559-2ad4-d561-68a5-497f2f3cf428@suse.cz> (raw)
In-Reply-To: <58fa71e3-cbc1-7bbd-47ef-fd4f226fc7a5@suse.cz>
[-- Attachment #1: Type: text/plain, Size: 198 bytes --]
On 6/2/20 1:48 PM, Martin Liška wrote:
> I tend to this approach. Let me prepare a patch candidate for it.
There's a patch for it. Can you please Jonathan take a look?
Thanks,
Martin
[-- Attachment #2: 0001-gcc-changelog-support-patterns.patch --]
[-- Type: text/x-patch, Size: 9157 bytes --]
From 4d2cf31b6deb03c9ddc8062b9a45d2511e4a58bb Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Tue, 2 Jun 2020 15:13:22 +0200
Subject: [PATCH] gcc-changelog: support patterns
contrib/ChangeLog:
* gcc-changelog/git_commit.py: Support foo/bar/*: patterns in
wildcard_prefixes locations.
* gcc-changelog/test_email.py: Test it.
* gcc-changelog/test_patches.txt: Add 3 new patches.
---
contrib/gcc-changelog/git_commit.py | 52 +++++++++++++---
contrib/gcc-changelog/test_email.py | 12 ++++
contrib/gcc-changelog/test_patches.txt | 86 ++++++++++++++++++++++++++
3 files changed, 142 insertions(+), 8 deletions(-)
diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py
index e2ef6c61ed0..37a3ef3fa92 100755
--- a/contrib/gcc-changelog/git_commit.py
+++ b/contrib/gcc-changelog/git_commit.py
@@ -136,6 +136,11 @@ ignored_prefixes = [
'libsanitizer/',
]
+wildcard_prefixes = [
+ 'gcc/testsuite/',
+ 'libstdc++-v3/doc/html/'
+ ]
+
misc_files = [
'gcc/DATESTAMP',
'gcc/BASE-VER',
@@ -182,11 +187,10 @@ class ChangeLogEntry:
self.initial_prs = list(prs)
self.prs = list(prs)
self.lines = []
+ self.files = []
+ self.file_patterns = []
- @property
- def files(self):
- files = []
-
+ def parse_file_names(self):
# Whether the content currently processed is between a star prefix the
# end of the file list: a colon or an open paren.
in_location = False
@@ -215,8 +219,10 @@ class ChangeLogEntry:
for file in line.split(','):
file = file.strip()
if file:
- files.append(file)
- return files
+ if file.endswith('*'):
+ self.file_patterns.append(file[:-1])
+ else:
+ self.files.append(file)
@property
def datetime(self):
@@ -275,8 +281,10 @@ class GitCommit:
self.parse_lines(all_are_ignored)
if self.changes:
self.parse_changelog()
+ self.parse_file_names()
self.check_for_empty_description()
self.deduce_changelog_locations()
+ self.check_file_patterns()
if not self.errors:
self.check_mentioned_files()
self.check_for_correct_changelog()
@@ -442,6 +450,18 @@ class GitCommit:
else:
last_entry.lines.append(line)
+ def parse_file_names(self):
+ for entry in self.changelog_entries:
+ entry.parse_file_names()
+
+ def check_file_patterns(self):
+ for entry in self.changelog_entries:
+ for pattern in entry.file_patterns:
+ name = os.path.join(entry.folder, pattern)
+ if name not in wildcard_prefixes:
+ msg = 'unsupported wilcard prefix'
+ self.errors.append(Error(msg, name))
+
def check_for_empty_description(self):
for entry in self.changelog_entries:
for i, line in enumerate(entry.lines):
@@ -502,6 +522,8 @@ class GitCommit:
assert folder_count == len(self.changelog_entries)
mentioned_files = set()
+ mentioned_patterns = []
+ used_patterns = set()
for entry in self.changelog_entries:
if not entry.files:
msg = 'ChangeLog must contain at least one file entry'
@@ -510,6 +532,8 @@ class GitCommit:
for file in entry.files:
if not self.is_changelog_filename(file):
mentioned_files.add(os.path.join(entry.folder, file))
+ for pattern in entry.file_patterns:
+ mentioned_patterns.append(os.path.join(entry.folder, pattern))
cand = [x[0] for x in self.modified_files
if not self.is_changelog_filename(x[0])]
@@ -543,9 +567,21 @@ class GitCommit:
assert file.startswith(entry.folder)
file = file[len(entry.folder):].lstrip('/')
entry.lines.append('\t* %s: New file.' % file)
+ entry.files.append(file)
else:
- msg = 'changed file not mentioned in a ChangeLog'
- self.errors.append(Error(msg, file))
+ used_pattern = [p for p in mentioned_patterns
+ if file.startswith(p)]
+ used_pattern = used_pattern[0] if used_pattern else None
+ if used_pattern:
+ used_patterns.add(used_pattern)
+ else:
+ msg = 'changed file not mentioned in a ChangeLog'
+ self.errors.append(Error(msg, file))
+
+ for pattern in mentioned_patterns:
+ if pattern not in used_patterns:
+ self.errors.append(Error('a file pattern not used in a patch',
+ pattern))
def check_for_correct_changelog(self):
for entry in self.changelog_entries:
diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py
index 2465669786e..308513011cb 100755
--- a/contrib/gcc-changelog/test_email.py
+++ b/contrib/gcc-changelog/test_email.py
@@ -318,3 +318,15 @@ class TestGccChangelog(unittest.TestCase):
assert len(email.errors) == 2
assert email.errors[0].message == 'missing description of a change'
assert email.errors[1].message == 'missing description of a change'
+
+ def test_libstdcxx_html_regenerated(self):
+ email = self.from_patch_glob('0001-Fix-text-of-hyperlink')
+ assert not email.errors
+ email = self.from_patch_glob('0002-libstdc-Fake-test-change-1.patch')
+ assert len(email.errors) == 1
+ assert email.errors[0].message == 'a file pattern not used in a patch'
+ assert email.errors[0].line == 'libstdc++-v3/doc/html/'
+ email = self.from_patch_glob('0003-libstdc-Fake-test-change-2.patch')
+ assert len(email.errors) == 1
+ msg = 'changed file not mentioned in a ChangeLog'
+ assert email.errors[0].message == msg
diff --git a/contrib/gcc-changelog/test_patches.txt b/contrib/gcc-changelog/test_patches.txt
index 25311fbf300..5d9b62d2637 100644
--- a/contrib/gcc-changelog/test_patches.txt
+++ b/contrib/gcc-changelog/test_patches.txt
@@ -2973,3 +2973,89 @@ index 1cd5872c03d..6f95aedb3d3 100644
+
--
2.26.2
+
+=== 0001-Fix-text-of-hyperlink-in-manual.patch ===
+From c7904d9e08a0ca3f733be3c2e8a3b912fa851fc5 Mon Sep 17 00:00:00 2001
+From: Jonathan Wakely <jwakely@redhat.com>
+Date: Fri, 8 Mar 2019 13:56:53 +0000
+Subject: [PATCH] Fix text of hyperlink in manual
+
+ * doc/xml/manual/using.xml: Use link element instead of xref.
+ * doc/html/*: Regenerate.
+
+---
+ libstdc++-v3/ChangeLog | 3 +++
+ libstdc++-v3/doc/html/manual/using_macros.html | 3 ++-
+ libstdc++-v3/doc/xml/manual/using.xml | 4 ++--
+ 3 files changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/libstdc++-v3/doc/html/manual/using_macros.html b/libstdc++-v3/doc/html/manual/using_macros.html
+index 7030bd2d0fd..dad6564a97d 100644
+--- a/libstdc++-v3/doc/html/manual/using_macros.html
++++ b/libstdc++-v3/doc/html/manual/using_macros.html
+@@ -1 +1,2 @@
+
++
+diff --git a/libstdc++-v3/doc/xml/manual/using.xml b/libstdc++-v3/doc/xml/manual/using.xml
+index 2d44a739406..7647e9b8dad 100644
+--- a/libstdc++-v3/doc/xml/manual/using.xml
++++ b/libstdc++-v3/doc/xml/manual/using.xml
+@@ -1 +1,2 @@
+
++
+--
+2.25.4
+
+=== 0002-libstdc-Fake-test-change-1.patch ===
+From fe4ade6778d1d97214db12bf2c40d0f40e7f953a Mon Sep 17 00:00:00 2001
+From: Jonathan Wakely <jwakely@redhat.com>
+Date: Tue, 2 Jun 2020 11:52:34 +0100
+Subject: [PATCH] libstdc++: Fake change for testing git_commit.py
+
+libstdc++-v3/ChangeLog:
+
+ * doc/xml/faq.xml: Fake change.
+ * doc/html/*: Regenerated.
+---
+ libstdc++-v3/doc/xml/faq.xml | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/libstdc++-v3/doc/xml/faq.xml b/libstdc++-v3/doc/xml/faq.xml
+index e419d3c22a0..bcc14dd6d90 100644
+--- a/libstdc++-v3/doc/xml/faq.xml
++++ b/libstdc++-v3/doc/xml/faq.xml
+@@ -1 +1,2 @@
+
++
+--
+2.25.4
+
+=== 0003-libstdc-Fake-test-change-2.patch ===
+From e460effb3a42c1c046b682fe266da418f2693ef3 Mon Sep 17 00:00:00 2001
+From: Jonathan Wakely <jwakely@redhat.com>
+Date: Tue, 2 Jun 2020 11:52:34 +0100
+Subject: [PATCH] libstdc++: Fake change for testing 2
+
+libstdc++-v3/ChangeLog:
+
+ * doc/xml/faq.xml: Fake change.
+---
+ libstdc++-v3/doc/html/faq.html | 2 +-
+ libstdc++-v3/doc/xml/faq.xml | 1 +
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/libstdc++-v3/doc/html/faq.html b/libstdc++-v3/doc/html/faq.html
+index 967e5f5f348..95d21b5bf9f 100644
+--- a/libstdc++-v3/doc/html/faq.html
++++ b/libstdc++-v3/doc/html/faq.html
+@@ -1 +1,2 @@
+
++
+--- a/libstdc++-v3/doc/xml/faq.xml
++++ b/libstdc++-v3/doc/xml/faq.xml
+@@ -1 +1,2 @@
+
++
+--
+2.25.4
+
--
2.26.2
next prev parent reply other threads:[~2020-06-02 13:16 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-25 22:48 Jakub Jelinek
2020-05-26 5:22 ` Hongtao Liu
2020-05-26 6:08 ` Martin Liška
2020-05-26 6:10 ` Hongtao Liu
2020-06-01 17:24 ` Jonathan Wakely
2020-06-02 6:44 ` Martin Liška
2020-06-02 11:06 ` Jonathan Wakely
2020-06-02 10:55 ` Gerald Pfeifer
2020-06-02 11:05 ` Jonathan Wakely
2020-06-02 11:09 ` Jonathan Wakely
2020-06-02 11:22 ` Jonathan Wakely
2020-06-02 11:48 ` Martin Liška
2020-06-02 13:16 ` Martin Liška [this message]
2020-06-02 13:56 ` Jonathan Wakely
2020-06-02 14:06 ` Martin Liška
2020-06-02 14:14 ` Jonathan Wakely
2020-06-02 14:25 ` Martin Liška
2020-06-09 20:29 ` Jonathan Wakely
2020-06-10 7:37 ` Martin Liška
2020-06-10 13:34 ` Tamar Christina
2020-06-10 13:39 ` Marek Polacek
2020-06-10 13:41 ` Martin Liška
2020-06-10 14:53 ` Tamar Christina
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f5e6d559-2ad4-d561-68a5-497f2f3cf428@suse.cz \
--to=mliska@suse.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=gcc@gcc.gnu.org \
--cc=gerald@pfeifer.com \
--cc=jakub@redhat.com \
--cc=jwakely.gcc@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).