diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-12-03 12:12:10 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-12-03 12:12:10 -0800 |
commit | f012991e2db06cc95f7aac8ecb74a1ac5f51f3d2 (patch) | |
tree | 582e5d7b377b6e973666a71960b28a7d11d72b07 /contrib | |
parent | 8d703821c69062c0cd255787d793e44f1a95d463 (diff) | |
parent | 3089f5feef36810c625b5813370a97b4ecc841f8 (diff) | |
download | gcc-f012991e2db06cc95f7aac8ecb74a1ac5f51f3d2.zip gcc-f012991e2db06cc95f7aac8ecb74a1ac5f51f3d2.tar.gz gcc-f012991e2db06cc95f7aac8ecb74a1ac5f51f3d2.tar.bz2 |
Merge from trunk revision 3089f5feef36810c625b5813370a97b4ecc841f8
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/ChangeLog | 42 | ||||
-rwxr-xr-x | contrib/gcc-changelog/git_commit.py | 60 | ||||
-rwxr-xr-x | contrib/gcc-changelog/test_email.py | 15 | ||||
-rw-r--r-- | contrib/gcc-changelog/test_patches.txt | 26 | ||||
-rwxr-xr-x | contrib/gcc-git-customization.sh | 4 | ||||
-rwxr-xr-x | contrib/mklog.py | 9 |
6 files changed, 122 insertions, 34 deletions
diff --git a/contrib/ChangeLog b/contrib/ChangeLog index c269e7c..2baa7f9 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,45 @@ +2020-12-02 Jason Merrill <jason@redhat.com> + + * gcc-git-customization.sh: Configure sendemail.to. + +2020-11-30 Martin Liska <mliska@suse.cz> + + * gcc-changelog/git_commit.py: Suggest close file for + 'unchanged file mentioned in a ChangeLog' error. + * gcc-changelog/test_email.py: Test it. + +2020-11-30 Martin Liska <mliska@suse.cz> + + * gcc-changelog/git_commit.py: Allow sub-directory wildcard + changelog entry. Fix a typo caused by apostrophe escaping. + * gcc-changelog/test_email.py: Test it. + * gcc-changelog/test_patches.txt: Likewise. + +2020-11-30 Jonathan Wakely <jwakely@redhat.com> + + * gcc-changelog/git_commit.py (wildcard_prefixes): Add libstdc++ + testsuite directory. + +2020-11-30 Martin Liska <mliska@suse.cz> + + * gcc-changelog/git_commit.py: Allow wildcard pattern only. + +2020-11-27 Martin Liska <mliska@suse.cz> + + * gcc-changelog/git_commit.py: Use regex for cherry pick prefix. + * gcc-changelog/test_email.py: Test it. + * gcc-changelog/test_patches.txt: Likewise. + +2020-11-25 Martin Liska <mliska@suse.cz> + + * gcc-changelog/git_commit.py: Use revert_regex instead + of string prefix. Convert sets to literals. + +2020-11-16 Martin Liska <mliska@suse.cz> + + * mklog.py: Do not call read on an input stream. + Fix some flake8 issues. + 2020-11-07 Lewis Hyatt <lhyatt@gmail.com> * unicode/EastAsianWidth.txt: Update to Unicode 13.0.0. diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py index 80ae0b2..0c43816 100755 --- a/contrib/gcc-changelog/git_commit.py +++ b/contrib/gcc-changelog/git_commit.py @@ -16,10 +16,11 @@ # along with GCC; see the file COPYING3. If not see # <http://www.gnu.org/licenses/>. */ +import difflib import os import re -changelog_locations = set([ +changelog_locations = { 'config', 'contrib', 'contrib/header-tools', @@ -72,9 +73,9 @@ changelog_locations = set([ 'libvtv', 'lto-plugin', 'maintainer-scripts', - 'zlib']) + 'zlib'} -bug_components = set([ +bug_components = { 'ada', 'analyzer', 'boehm-gc', @@ -123,9 +124,9 @@ bug_components = set([ 'testsuite', 'translation', 'tree-optimization', - 'web']) + 'web'} -ignored_prefixes = [ +ignored_prefixes = { 'gcc/d/dmd/', 'gcc/go/gofrontend/', 'gcc/testsuite/gdc.test/', @@ -134,18 +135,19 @@ ignored_prefixes = [ 'libphobos/libdruntime/', 'libphobos/src/', 'libsanitizer/', - ] + } -wildcard_prefixes = [ +wildcard_prefixes = { 'gcc/testsuite/', - 'libstdc++-v3/doc/html/' - ] + 'libstdc++-v3/doc/html/', + 'libstdc++-v3/testsuite/' + } -misc_files = [ +misc_files = { 'gcc/DATESTAMP', 'gcc/BASE-VER', 'gcc/DEV-PHASE' - ] + } author_line_regex = \ re.compile(r'^(?P<datetime>\d{4}-\d{2}-\d{2})\ {2}(?P<name>.* <.*>)') @@ -157,12 +159,12 @@ star_prefix_regex = re.compile(r'\t\*(?P<spaces>\ *)(?P<content>.*)') end_of_location_regex = re.compile(r'[\[<(:]') item_empty_regex = re.compile(r'\t(\* \S+ )?\(\S+\):\s*$') item_parenthesis_regex = re.compile(r'\t(\*|\(\S+\):)') +revert_regex = re.compile(r'This reverts commit (?P<hash>\w+).$') +cherry_pick_regex = re.compile(r'cherry picked from commit (?P<hash>\w+)') LINE_LIMIT = 100 TAB_WIDTH = 8 CO_AUTHORED_BY_PREFIX = 'co-authored-by: ' -CHERRY_PICK_PREFIX = '(cherry picked from commit ' -REVERT_PREFIX = 'This reverts commit ' REVIEW_PREFIXES = ('reviewed-by: ', 'reviewed-on: ', 'signed-off-by: ', 'acked-by: ', 'tested-by: ', 'reported-by: ', @@ -274,8 +276,9 @@ class GitCommit: # Identify first if the commit is a Revert commit for line in self.info.lines: - if line.startswith(REVERT_PREFIX): - self.revert_commit = line[len(REVERT_PREFIX):].rstrip('.') + m = revert_regex.match(line) + if m: + self.revert_commit = m.group('hash') break if self.revert_commit: self.info = self.commit_to_info_hook(self.revert_commit) @@ -421,14 +424,16 @@ class GitCommit: continue elif lowered_line.startswith(REVIEW_PREFIXES): continue - elif line.startswith(CHERRY_PICK_PREFIX): - commit = line[len(CHERRY_PICK_PREFIX):].rstrip(')') - if self.cherry_pick_commit: - self.errors.append(Error('multiple cherry pick lines', - line)) - else: - self.cherry_pick_commit = commit - continue + else: + m = cherry_pick_regex.search(line) + if m: + commit = m.group('hash') + if self.cherry_pick_commit: + msg = 'multiple cherry pick lines' + self.errors.append(Error(msg, line)) + else: + self.cherry_pick_commit = commit + continue # ChangeLog name will be deduced later if not last_entry: @@ -489,7 +494,7 @@ class GitCommit: 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: + if not [name.startswith(pr) for pr in wildcard_prefixes]: msg = 'unsupported wildcard prefix' self.errors.append(Error(msg, name)) @@ -557,7 +562,7 @@ class GitCommit: mentioned_patterns = [] used_patterns = set() for entry in self.changelog_entries: - if not entry.files: + if not entry.files and not entry.file_patterns: msg = 'no files mentioned for ChangeLog in directory' self.errors.append(Error(msg, entry.folder)) assert not entry.folder.endswith('/') @@ -572,6 +577,9 @@ class GitCommit: changed_files = set(cand) for file in sorted(mentioned_files - changed_files): msg = 'unchanged file mentioned in a ChangeLog' + candidates = difflib.get_close_matches(file, changed_files, 1) + if candidates: + msg += f' (did you mean "{candidates[0]}"?)' self.errors.append(Error(msg, file)) for file in sorted(changed_files - mentioned_files): if not self.in_ignored_location(file): @@ -613,7 +621,7 @@ class GitCommit: for pattern in mentioned_patterns: if pattern not in used_patterns: - error = 'pattern doesn''t match any changed files' + error = "pattern doesn't match any changed files" self.errors.append(Error(error, pattern)) def check_for_correct_changelog(self): diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py index e38c3e5..8f5129e 100755 --- a/contrib/gcc-changelog/test_email.py +++ b/contrib/gcc-changelog/test_email.py @@ -113,7 +113,9 @@ class TestGccChangelog(unittest.TestCase): email = self.from_patch_glob('0096') assert email.errors err = email.errors[0] - assert err.message == 'unchanged file mentioned in a ChangeLog' + assert err.message == 'unchanged file mentioned in a ChangeLog (did ' \ + 'you mean "gcc/testsuite/gcc.target/aarch64/' \ + 'advsimd-intrinsics/vdot-3-1.c"?)' assert err.line == 'gcc/testsuite/gcc.target/aarch64/' \ 'advsimd-intrinsics/vdot-compile-3-1.c' @@ -333,7 +335,7 @@ class TestGccChangelog(unittest.TestCase): 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' + 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') @@ -355,6 +357,8 @@ class TestGccChangelog(unittest.TestCase): def test_backport(self): email = self.from_patch_glob('0001-asan-fix-RTX-emission.patch') assert not email.errors + expected_hash = '8cff672cb9a132d3d3158c2edfc9a64b55292b80' + assert email.cherry_pick_commit == expected_hash assert len(email.changelog_entries) == 1 entry = list(email.to_changelog_entries())[0][1] assert entry.startswith('2020-06-11 Martin Liska <mliska@suse.cz>') @@ -384,3 +388,10 @@ class TestGccChangelog(unittest.TestCase): email = self.from_patch_glob('0001-lto-fix-LTO-debug') assert not email.errors assert len(email.changelog_entries) == 1 + + def test_wildcard_in_subdir(self): + email = self.from_patch_glob('0001-Wildcard-subdirs.patch') + assert len(email.changelog_entries) == 1 + err = email.errors[0] + assert err.message == "pattern doesn't match any changed files" + assert err.line == 'libstdc++-v3/testsuite/28_regex_not-existing/' diff --git a/contrib/gcc-changelog/test_patches.txt b/contrib/gcc-changelog/test_patches.txt index 37f49c8..02ce28d 100644 --- a/contrib/gcc-changelog/test_patches.txt +++ b/contrib/gcc-changelog/test_patches.txt @@ -3145,7 +3145,7 @@ gcc/ChangeLog: by using Pmode instead of ptr_mode. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> -(cherry picked from commit 8cff672cb9a132d3d3158c2edfc9a64b55292b80) +(cherry picked from commit 8cff672cb9a132d3d3158c2edfc9a64b55292b80 (only part)) --- gcc/asan.c | 1 + 1 file changed, 1 insertion(+) @@ -3320,3 +3320,27 @@ index 7c9d492f6a4..37e73348cb7 100644 -- 2.25.1 +=== 0001-Wildcard-subdirs.patch === +From b798205595426c53eb362065f6ed6c320dcc161d Mon Sep 17 00:00:00 2001 +From: Martin Liska <mliska@suse.cz> +Date: Mon, 30 Nov 2020 13:27:51 +0100 +Subject: [PATCH] Fix it. + +libstdc++-v3/ChangeLog: + + * testsuite/28_regex/*: Fix them all. + * testsuite/28_regex_not-existing/*: Fix them all. +--- + contrib/gcc-changelog/git_commit.py | 1 + + libstdc++-v3/testsuite/28_regex/init-list.cc | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/libstdc++-v3/testsuite/28_regex/init-list.cc b/libstdc++-v3/testsuite/28_regex/init-list.cc +index f51453f019a..d10ecf483f4 100644 +--- a/libstdc++-v3/testsuite/28_regex/init-list.cc ++++ b/libstdc++-v3/testsuite/28_regex/init-list.cc +@@ -1 +1,2 @@ + ++ +-- +2.29.2 diff --git a/contrib/gcc-git-customization.sh b/contrib/gcc-git-customization.sh index 200b81e..e7e6662 100755 --- a/contrib/gcc-git-customization.sh +++ b/contrib/gcc-git-customization.sh @@ -35,6 +35,10 @@ git config alias.gcc-commit-mklog '!f() { GCC_FORCE_MKLOG=1 git commit "$@"; }; # *.md diff=md git config diff.md.xfuncname '^\(define.*$' +# Tell git send-email where patches go. +# ??? Maybe also set sendemail.tocmd to guess from MAINTAINERS? +git config sendemail.to 'gcc-patches@gcc.gnu.org' + set_user=$(git config --get "user.name") set_email=$(git config --get "user.email") diff --git a/contrib/mklog.py b/contrib/mklog.py index 1e85dfe..57be299 100755 --- a/contrib/mklog.py +++ b/contrib/mklog.py @@ -50,7 +50,7 @@ template_and_param_regex = re.compile(r'<[^<>]*>') bugzilla_url = 'https://gcc.gnu.org/bugzilla/rest.cgi/bug?id=%s&' \ 'include_fields=summary' -function_extensions = set(['.c', '.cpp', '.C', '.cc', '.h', '.inc', '.def']) +function_extensions = {'.c', '.cpp', '.C', '.cc', '.h', '.inc', '.def'} help_message = """\ Generate ChangeLog template for PATCH. @@ -111,8 +111,8 @@ def sort_changelog_files(changed_file): def get_pr_titles(prs): output = '' for pr in prs: - id = pr.split('/')[-1] - r = requests.get(bugzilla_url % id) + pr_id = pr.split('/')[-1] + r = requests.get(bugzilla_url % pr_id) bugs = r.json()['bugs'] if len(bugs) == 1: output += '%s - %s\n' % (pr, bugs[0]['summary']) @@ -242,8 +242,7 @@ if __name__ == '__main__': if args.input == '-': args.input = None - input = open(args.input) if args.input else sys.stdin - data = input.read() + data = open(args.input) if args.input else sys.stdin output = generate_changelog(data, args.no_functions, args.fill_up_bug_titles) if args.changelog: |