On Mon, 25 May 2020 at 23:50, Jakub Jelinek via Gcc <g...@gcc.gnu.org> wrote:
>
> Hi!
>
> I've turned the strict mode of Martin Liška's hook changes,
> which means that from now on no commits to the trunk or release branches
> should be changing any ChangeLog files together with the other files,
> ChangeLog entry should be solely in the commit message.
> The DATESTAMP bumping script will be updating the ChangeLog files for you.
> If somebody makes a mistake in that, please wait 24 hours (at least until
> after 00:16 UTC after your commit) so that the script will create the
> ChangeLog entries, and afterwards it can be fixed by adjusting the ChangeLog
> files.  But you can only touch the ChangeLog files in that case (and
> shouldn't write a ChangeLog entry for that in the commit message).
>
> If anything goes wrong, please let me, other RMs and Martin Liška know.

The libstdc++ manual is written in Docbook XML, but we commit both the
XML and generated HTML pages to Git. Sometimes a small XML file can
result in dozens of mechanical changes to the generated HTML files,
which we record in the ChangeLog as:

    * doc/html/*: Regenerated.

With the new checks we need to name every generated file individually.

If we add that directory to the ignored_prefixes list, we won't need
to name them. But then the doc/html/* entry will give an error, and
changes to the HTML files can be committed without any ChangeLog
entry. Should we just stop mentioning the HTML in the ChangeLog?

We could do something like the attached patch, but it seems overkill
for this one special case.
diff --git a/contrib/gcc-changelog/git_commit.py 
b/contrib/gcc-changelog/git_commit.py
index 4f82b58f64b..add0defaeed 100755
--- a/contrib/gcc-changelog/git_commit.py
+++ b/contrib/gcc-changelog/git_commit.py
@@ -501,6 +501,7 @@ class GitCommit:
         assert folder_count == len(self.changelog_entries)
 
         mentioned_files = set()
+        libstdcxx_html_regenerated = False
         for entry in self.changelog_entries:
             if not entry.files:
                 msg = 'ChangeLog must contain a file entry'
@@ -508,16 +509,33 @@ class GitCommit:
             assert not entry.folder.endswith('/')
             for file in entry.files:
                 if not self.is_changelog_filename(file):
-                    mentioned_files.add(os.path.join(entry.folder, file))
+                    file = os.path.join(entry.folder, file)
+                    if file == 'libstdc++-v3/doc/html/*':
+                        libstdcxx_html_regenerated = True
+                    else:
+                        mentioned_files.add(file)
 
         cand = [x[0] for x in self.modified_files
                 if not self.is_changelog_filename(x[0])]
         changed_files = set(cand)
+        if libstdcxx_html_regenerated:
+            libstdcxx_html_regenerated = False
+            for c in changed_files:
+                if c.startswith('libstdc++-v3/doc/html/'):
+                    libstdcxx_html_regenerated = True
+                    break
+            if not libstdcxx_html_regenerated:
+                self.errors.append(Error('No libstdc++ HTML changes found'))
+
         for file in sorted(mentioned_files - changed_files):
             self.errors.append(Error('file not changed in a patch', file))
         for file in sorted(changed_files - mentioned_files):
             if not self.in_ignored_location(file):
-                if file in self.new_files:
+                if file.startswith('libstdc++-v3/doc/html/'):
+                    if not libstdcxx_html_regenerated:
+                        msg = 'libstdc++ HTML changes not in ChangeLog'
+                        self.errors.append(Error(msg, file))
+                elif file in self.new_files:
                     changelog_location = self.get_changelog_by_path(file)
                     # Python2: we cannot use next(filter(...))
                     entries = filter(lambda x: x.folder == changelog_location,

Reply via email to