diff options
author | Martin Liska <mliska@suse.cz> | 2022-01-24 13:03:01 +0100 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2022-01-24 13:26:30 +0100 |
commit | 978abe918f8c8deed28e92297d3c0cc39086ad83 (patch) | |
tree | 6ddce99632f3b7a9dcc09e668e807fda6f990be9 /contrib/gcc-changelog | |
parent | f1af8528d34418bc874ae9d993ee0dc3559972d2 (diff) | |
download | gcc-978abe918f8c8deed28e92297d3c0cc39086ad83.zip gcc-978abe918f8c8deed28e92297d3c0cc39086ad83.tar.gz gcc-978abe918f8c8deed28e92297d3c0cc39086ad83.tar.bz2 |
gcc-changelog: Be stricter for top-level dir.
contrib/ChangeLog:
* gcc-changelog/git_commit.py: New files in toplev must
be explicitly marked as "New file".
* gcc-changelog/test_email.py: Test.
* gcc-changelog/test_patches.txt: Add test.
Diffstat (limited to 'contrib/gcc-changelog')
-rwxr-xr-x | contrib/gcc-changelog/git_commit.py | 12 | ||||
-rwxr-xr-x | contrib/gcc-changelog/test_email.py | 5 | ||||
-rw-r--r-- | contrib/gcc-changelog/test_patches.txt | 82 |
3 files changed, 96 insertions, 3 deletions
diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py index 27a1d59..95dc49e 100755 --- a/contrib/gcc-changelog/git_commit.py +++ b/contrib/gcc-changelog/git_commit.py @@ -718,9 +718,15 @@ class GitCommit: self.changelog_entries.append(entry) # strip prefix of the file assert file.startswith(entry.folder) - file = file[len(entry.folder):].lstrip('/') - entry.lines.append('\t* %s: New file.' % file) - entry.files.append(file) + # do not allow auto-addition of New files + # for the top-level folder + if entry.folder: + file = file[len(entry.folder):].lstrip('/') + entry.lines.append('\t* %s: New file.' % file) + entry.files.append(file) + else: + msg = 'new file in the top-level folder not mentioned in a ChangeLog' + self.errors.append(Error(msg, file)) else: used_pattern = [p for p in mentioned_patterns if file.startswith(p)] diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py index a4796db..c56f6da 100755 --- a/contrib/gcc-changelog/test_email.py +++ b/contrib/gcc-changelog/test_email.py @@ -446,3 +446,8 @@ class TestGccChangelog(unittest.TestCase): email = self.from_patch_glob('non-ascii-email.patch') assert (email.errors[0].message == 'non-ASCII characters in git commit email address (jbglaw@ług-owl.de)') + + def test_new_file_in_root_folder(self): + email = self.from_patch_glob('toplev-new-file.patch') + assert (email.errors[0].message == + 'new file in the top-level folder not mentioned in a ChangeLog') diff --git a/contrib/gcc-changelog/test_patches.txt b/contrib/gcc-changelog/test_patches.txt index 98a0d3f..95ad961 100644 --- a/contrib/gcc-changelog/test_patches.txt +++ b/contrib/gcc-changelog/test_patches.txt @@ -3489,3 +3489,85 @@ index 2a9917cde62..0033b0004b3 100644 @@ -0,0 +1,1 @@ + -- + +=== toplev-new-file.patch === +From 05e37b6e65027188f08e6374c7d356d75b54738e Mon Sep 17 00:00:00 2001 +From: Martin Liska <mliska@suse.cz> +Date: Mon, 24 Jan 2022 12:46:27 +0100 +Subject: [PATCH] New file. + +ChangeLog: + + * Makefile.in: Update. + +gcc/ChangeLog: + + * ipa-icf.cc: Update. +--- + Makefile.am | 1 + + Makefile.in | 1 + + gcc/ipa-icf.cc | 1 + + gcc/ipa-icf2.cc | 1 + + 4 files changed, 4 insertions(+) + create mode 100644 Makefile.am + create mode 100644 gcc/ipa-icf2.cc + +diff --git a/Makefile.am b/Makefile.am +new file mode 100644 +index 00000000000..f0129caae3d +--- /dev/null ++++ b/Makefile.am +@@ -0,0 +1 @@ ++new file. +diff --git a/Makefile.in b/Makefile.in +index 79c77fccf0f..7a090030119 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -1,4 +1,5 @@ + ++ + # Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'. + # + # Makefile for directory with subdirs to build. +diff --git a/gcc/ipa-icf.cc b/gcc/ipa-icf.cc +index 765ae746745..15735b6684f 100644 +--- a/gcc/ipa-icf.cc ++++ b/gcc/ipa-icf.cc +@@ -1,3 +1,4 @@ ++ + /* Interprocedural Identical Code Folding pass + Copyright (C) 2014-2022 Free Software Foundation, Inc. + +diff --git a/gcc/ipa-icf2.cc b/gcc/ipa-icf2.cc +new file mode 100644 +index 00000000000..c49c556e0e4 +--- /dev/null ++++ b/gcc/ipa-icf2.cc +@@ -0,0 +1 @@ ++tt +-- +2.34.1 + +From 80c9d63af350b280bfccb82adb3867c25a25e6d0 Mon Sep 17 00:00:00 2001 +From: Martin Liska <mliska@suse.cz> +Date: Mon, 24 Jan 2022 12:17:09 +0100 +Subject: [PATCH] Add Makefile.am file. + +Foo bar. + +ChangeLog: + +--- + Makefile.am | 0 + 1 file changed, 0 insertions(+), 0 deletions(-) + create mode 100644 Makefile.am + +diff --git a/Makefile.am b/Makefile.am +new file mode 100644 +index 00000000000..d6459e00543 +--- /dev/null ++++ b/Makefile.am +@@ -0,0 +1 @@ ++xxx +-- +2.34.1 |