patman: add option for limiting the Cc list
PATCH v3 1/2 patman: add option for limiting the Cc list
Many mailing-lists consider a long Cc list a sign of spam and will either drop the message or mark it for moderation. Because patman automatically invokes get_maintainer.pl the Cc list can expand unexpectedly. Allow the user to specify a limit for the Cc list.
This limit is applied after removing any known bouncing addresses. By default no limit is applied.
---
I've fallen foul of the u-boot ML Cc limit a few times recently. I'm not sure what the actual limit is so I've left patman's default behaviour unlimited.
Changes in v3:
- update func_test
Changes in v2:
- make default None to allow limit 0 to suppress the list completely
tools/patman/func_test.py | 3 ++- tools/patman/patman.py | 4 +++- tools/patman/series.py | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-)
tools/patman/func_test.py +2 -1
@@ -149,7 +149,8 @@ class TestFunctional(unittest.TestCase): patchstream.InsertCoverLetter(cover_fname, series, count) series.DoChecks() cc_file = series.MakeCcFile(process_tags, cover_fname, - not ignore_bad_tags, add_maintainers) + not ignore_bad_tags, add_maintainers, + None) cmd = gitutil.EmailPatches(series, cover_fname, args, dry_run, not ignore_bad_tags, cc_file, in_reply_to=in_reply_to, thread=None)
tools/patman/patman.py +3 -1
@@ -38,6 +38,8 @@ parser.add_option('-i', '--ignore-errors', action='store_true', parser.add_option('-m', '--no-maintainers', action='store_false', dest='add_maintainers', default=True, help="Don't cc the file maintainers automatically") +parser.add_option('-l', '--limit-cc', dest='limit', type='int', + default=None, help='Limit the cc list to LIMIT entries [default: %default]') parser.add_option('-n', '--dry-run', action='store_true', dest='dry_run', default=False, help="Do a dry run (create but don't email patches)") parser.add_option('-p', '--project', default=project.DetectProject(),
@@ -157,7 +159,7 @@ else: cc_file = series.MakeCcFile(options.process_tags, cover_fname, not options.ignore_bad_tags, - options.add_maintainers) + options.add_maintainers, options.limit) # Email the patches out (giving the user time to check / cancel) cmd = ''
tools/patman/series.py +4 -1
@@ -202,7 +202,7 @@ class Series(dict): print(col.Color(col.RED, str)) def MakeCcFile(self, process_tags, cover_fname, raise_on_error, - add_maintainers): + add_maintainers, limit): """Make a cc file for us to use for per-commit Cc automation Also stores in self._generated_cc to make ShowActions() faster.
@@ -215,6 +215,7 @@ class Series(dict): add_maintainers: Either: True/False to call the get_maintainers to CC maintainers List of maintainers to include (for testing) + limit: Limit the length of the Cc list Return: Filename of temp file created """
@@ -238,6 +239,8 @@ class Series(dict): print(col.Color(col.YELLOW, 'Skipping "%s"' % x)) cc = set(cc) - set(settings.bounces) cc = [m.encode('utf-8') if type(m) != str else m for m in cc] + if limit is not None: + cc = cc[:limit] all_ccs += cc print(commit.patch, ', '.join(set(cc)), file=fd) self._generated_cc[commit.patch] = cc
Signature · 1 line
2.17.1
PATCH v3 2/2 patman: add test for SPDX license
Add a test to exercise the check for a valid SPDX license.
---
This is dependent on http://patchwork.ozlabs.org/patch/914202/
I also seem to get a bunch of doctest failures due to unicode strings, e.g.
File "tools/patman/settings.py", line 78, in settings._ProjectConfigParser Failed example:
sorted(config.items("settings"))
Expected:
[('am_hero', 'True')]
Got:
[('am_hero', u'True')I haven't attempted to fix these as I suspect they might be python version (2.7.12 for me) and/or locale dependent.
Changes in v3:
- new
Changes in v2: None
tools/patman/test.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
tools/patman/test.py +16 -2
@@ -148,7 +148,7 @@ index 0000000..2234c87 --- /dev/null +++ b/common/bootstage.c @@ -0,0 +1,37 @@ -+// SPDX-License-Identifier: GPL-2.0+ ++%s +/* + * Copyright (c) 2011, Google Inc. All rights reserved. + *
@@ -189,19 +189,22 @@ index 0000000..2234c87 1.7.3.1 ''' signoff = 'Signed-off-by: Simon Glass <[email protected]>\n' + license = '// SPDX-License-Identifier: GPL-2.0+' tab = ' ' indent = ' ' if data_type == 'good': pass elif data_type == 'no-signoff': signoff = '' + elif data_type == 'no-license': + license = '' elif data_type == 'spaces': tab = ' ' elif data_type == 'indent': indent = tab else: print('not implemented') - return data % (signoff, tab, indent, tab) + return data % (signoff, license, tab, indent, tab) def SetupData(self, data_type): inhandle, inname = tempfile.mkstemp()
@@ -234,6 +237,17 @@ index 0000000..2234c87 self.assertEqual(result.lines, 62) os.remove(inf) + def testNoLicense(self): + inf = self.SetupData('no-license') + result = checkpatch.CheckPatch(inf) + self.assertEqual(result.ok, False) + self.assertEqual(len(result.problems), 1) + self.assertEqual(result.errors, 0) + self.assertEqual(result.warnings, 1) + self.assertEqual(result.checks, 0) + self.assertEqual(result.lines, 62) + os.remove(inf) + def testSpaces(self): inf = self.SetupData('spaces') result = checkpatch.CheckPatch(inf)
Signature · 1 line
2.17.1
PATCH v3 2/2 patman: add test for SPDX license
Quoted 12 lines · Chris Packham
Add a test to exercise the check for a valid SPDX license.
Signed-off-by Chris Packham <[email protected]>---
This is dependent on http://patchwork.ozlabs.org/patch/914202/I also seem to get a bunch of doctest failures due to unicode strings, e.g.
File "
tools/patman/settings.py", line 78, in settings._ProjectConfigParser Failed example:
sorted(config.items("settings"))
Expected:
Quoted 6 lines
[('am_hero', 'True')] Got: [('am_hero', u'True')I haven't attempted to fix these as I suspect they might be python version (2.7.12 for me) and/or locale dependent.
That is a bit odd since I would expect those lists to be the same. Normally you can compare uincode and strings without any trouble.
Quoted 9 lines
Changes in v3:
- newChanges in v2: None
tools/patman/test.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
PATCH v3 2/2 patman: add test for SPDX license
Quoted 27 lines · Simon Glass
Quoted 12 lines · Chris Packham
Add a test to exercise the check for a valid SPDX license.
Signed-off-by Chris Packham <[email protected]>---
This is dependent on http://patchwork.ozlabs.org/patch/914202/I also seem to get a bunch of doctest failures due to unicode strings, e.g.
File "
tools/patman/settings.py", line 78, in settings._ProjectConfigParser Failed example:
sorted(config.items("settings"))
Expected:Quoted 6 lines
[('am_hero', 'True')] Got: [('am_hero', u'True')I haven't attempted to fix these as I suspect they might be python version (2.7.12 for me) and/or locale dependent.
That is a bit odd since I would expect those lists to be the same. Normally you can compare uincode and strings without any trouble.
Quoted 4 lines
Changes in v3:
- new
Quoted 7 lines
Quoted 5 lines
Changes in v2: None
tools/patman/test.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)Reviewed-by Simon Glass <[email protected]>
Applied to u-boot-dm, thanks!
PATCH v3 1/2 patman: add option for limiting the Cc list
In reply to Chris PackhamQuoted 17 lines · Chris Packham
Many mailing-lists consider a long Cc list a sign of spam and will either drop the message or mark it for moderation. Because patman automatically invokes get_maintainer.pl the Cc list can expand unexpectedly. Allow the user to specify a limit for the Cc list.
This limit is applied after removing any known bouncing addresses. By default no limit is applied.
Signed-off-by Chris Packham <[email protected]>---
I've fallen foul of the u-boot ML Cc limit a few times recently. I'm not sure what the actual limit is so I've left patman's default behaviour unlimited.Changes in v3:
- updatefunc_test
Quoted 7 lines
Changes in v2:
- make default None to allow limit 0 to suppress the list completelytools/patman/func_test.py | 3 ++- tools/patman/patman.py | 4 +++- tools/patman/series.py | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-)
PATCH v3 1/2 patman: add option for limiting the Cc list
Quoted 21 lines · Simon Glass
Quoted 20 lines · Chris Packham
Many mailing-lists consider a long Cc list a sign of spam and will either drop the message or mark it for moderation. Because patman automatically invokes get_maintainer.pl the Cc list can expand unexpectedly. Allow the user to specify a limit for the Cc list.
This limit is applied after removing any known bouncing addresses. By default no limit is applied.
Signed-off-by Chris Packham <[email protected]>---
I've fallen foul of the u-boot ML Cc limit a few times recently. I'm not sure what the actual limit is so I've left patman's default behaviour unlimited.Changes in v3:
- updatefunc_testChanges in v2:
- make default None to allow limit 0 to suppress the list completely
Quoted 6 lines
Quoted 4 lines
tools/patman/func_test.py | 3 ++- tools/patman/patman.py | 4 +++- tools/patman/series.py | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-)Reviewed-by Simon Glass <[email protected]>
Applied to u-boot-dm, thanks!