[IMPORTANT] ChangeLog related changes

Jonathan Wakely jwakely.gcc@gmail.com
Tue Jun 2 11:06:07 GMT 2020


On Tue, 2 Jun 2020 at 07:44, Martin Liška <mliska@suse.cz> wrote:
>
> On 6/1/20 7:24 PM, Jonathan Wakely wrote:
> > On Mon, 25 May 2020 at 23:50, Jakub Jelinek via Gcc <gcc@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.
> >
>
> The patch is fine to me.
> Can you please a pytest for the situation: contrib/gcc-changelog/test_email.py ?

Tests now added (and passing) for the positive case and both negative cases.
-------------- next part --------------
commit 21f171e1f8af7e222a87523d7957174f985a1dd5
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Jun 1 18:33:48 2020 +0100

    gcc-changelog: Allow "doc/html/*" in libstdc++ changelog
    
    contrib/ChangeLog:
    
            * gcc-changelog/git_commit.py (check_mentioned_files): Allow
            wildcard path for generated files in libstdc++-v3/doc/html.
            * gcc-changelog/test_email.py (test_libstdcxx_html_regenerated):
            New test.
            * gcc-changelog/test_patches.txt: Add patches.

diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py
index b8c7f718c50..d723d890f31 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 at least one 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,
diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py
index 2465669786e..3f4bc9dffd0 100755
--- a/contrib/gcc-changelog/test_email.py
+++ b/contrib/gcc-changelog/test_email.py
@@ -318,3 +318,14 @@ 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-in-manual')
+        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 == 'No libstdc++ HTML changes found'
+        email = self.from_patch_glob('0003-libstdc-Fake-test-change-2.patch')
+        assert len(email.errors) == 1
+        msg = 'libstdc++ HTML changes not in 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..2c308f6477c 100644
--- a/contrib/gcc-changelog/test_patches.txt
+++ b/contrib/gcc-changelog/test_patches.txt
@@ -2973,3 +2973,127 @@ 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/ChangeLog b/libstdc++-v3/ChangeLog
+index e752285bdb2..7da25945a8c 100644
+--- a/libstdc++-v3/ChangeLog
++++ b/libstdc++-v3/ChangeLog
+@@ -1,5 +1,8 @@
+ 2019-03-08  Jonathan Wakely  <jwakely@redhat.com>
+ 
++	* doc/xml/manual/using.xml: Use link element instead of xref.
++	* doc/html/*: Regenerate.
++
+ 	* include/bits/fs_path.h (path::format): Add fixed underlying type.
+ 
+ 2019-03-08  François Dumont  <fdumont@gcc.gnu.org>
+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
+@@ -116,7 +116,8 @@
+         enabled for
+         <code class="classname">std::vector<T, std::allocator<T>></code>
+         and only when <code class="classname">std::allocator</code> is derived from
+-        <a class="xref" href="memory.html#allocator.impl" title="Implementation">the section called “Implementation”</a>. The annotations
++        <a class="link" href="memory.html#allocator.impl" title="Implementation"><code class="classname">new_allocator</code>
++        or <code class="classname">malloc_allocator</code></a>. The annotations
+         must be present on all vector operations or none, so this macro must
+         be defined to the same value for all translation units that create,
+         destroy or modify vectors.
+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
+@@ -1192,8 +1192,8 @@ g++ -Winvalid-pch -I. -include stdc++.h -H -g -O2 hello.cc -o test.exe
+         enabled for
+         <classname>std::vector<T, std::allocator<T>></classname>
+         and only when <classname>std::allocator</classname> is derived from
+-        <xref linkend="allocator.impl"><classname>new_allocator</classname>
+-        or <classname>malloc_allocator</classname></xref>. The annotations
++        <link linkend="allocator.impl"><classname>new_allocator</classname>
++        or <classname>malloc_allocator</classname></link>. The annotations
+         must be present on all vector operations or none, so this macro must
+         be defined to the same value for all translation units that create,
+         destroy or modify vectors.
+-- 
+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
+@@ -1315,3 +1315,4 @@
+ </article>
+ 
+ </book>
++fake change
+-- 
+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
+@@ -910,4 +910,4 @@
+     </p><p>
+     See <a class="link" href="manual/strings.html#strings.string.shrink" title="Shrink to Fit">Shrink-to-fit
+     strings</a> for a similar solution for strings.
+-    </p></td></tr></tbody></table></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="bk03.html">Up</a></td><td width="40%" align="right"> </td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>
+\ No newline at end of file
++    </p></td></tr></tbody></table></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="bk03.html">Up</a></td><td width="40%" align="right"> </td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>fake change
+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
+@@ -1315,3 +1315,4 @@
+ </article>
+ 
+ </book>
++fake change
+-- 
+2.25.4
+


More information about the Gcc-patches mailing list