On 30/01/24 15:02 +0000, Jonathan Wakely wrote:
That way other subdirectories could add their own extra generated files to it.
Like so.
mklog: Add lookup for generated files in specific sub-directories
The mklog.py output for libstdc++-v3/include/bits/version.h is awful.
Teaching mklog.py that it's generated makes it correctly use
"Regenerate" for its changes. We can do the same for the other new
generated headers as well.
This change adds a new dict with directories as keys, and a set of
filenames as the values. The location of the ChangeLog file can be
looked up in the dict and then the relative_path looked up in the set.
contrib/ChangeLog:
* mklog.py (subdir_generated_files): New dict of per-directory
generated files.
(generate_changelog): Use subdir_generated_files.
diff --git a/contrib/mklog.py b/contrib/mklog.py
index d764fb41f99..b9631f92600 100755
--- a/contrib/mklog.py
+++ b/contrib/mklog.py
@@ -92,6 +92,12 @@ function_extensions = {'.c', '.cpp', '.C', '.cc', '.h',
'.inc', '.def', '.md'}
# NB: Makefile.in isn't listed as it's not always generated.
generated_files = {'aclocal.m4', 'config.h.in', 'configure'}
+subdir_generated_files = {
+'libstdc++-v3': { 'include/bits/version.h',
+ 'include/bits/text_encoding-data.h'
+ 'include/bits/unicode-data.h' }
+}
+
help_message = """\
Generate ChangeLog template for PATCH.
PATCH must be generated using diff(1)'s -up or -cp options
@@ -284,6 +290,9 @@ def generate_changelog(data, no_functions=False,
fill_pr_titles=False,
elif os.path.basename(file.path) in generated_files:
out += '\t* %s: Regenerate.\n' % (relative_path)
append_changelog_line(out, relative_path, 'Regenerate.')
+ elif relative_path in subdir_generated_files.get(changelog, {}):
+ out += '\t* %s: Regenerate.\n' % (relative_path)
+ append_changelog_line(out, relative_path, 'Regenerate.')
else:
if not no_functions:
for hunk in file: