'libsanitizer/',
]
+wildcard_prefixes = [
+ 'gcc/testsuite/',
+ 'libstdc++-v3/doc/html/'
+ ]
+
misc_files = [
'gcc/DATESTAMP',
'gcc/BASE-VER',
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
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):
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()
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 wildcard 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):
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'
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])]
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:
+ error = 'pattern doesn''t match any changed files'
+ self.errors.append(Error(error, pattern))
def check_for_correct_changelog(self):
for entry in self.changelog_entries:
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
+ msg = 'pattern doesn''t match any changed files'
+ assert email.errors[0].message == msg
+ 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
+
--
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
+