diff options
author | Tom Rini <trini@konsulko.com> | 2018-06-25 10:57:07 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-06-25 10:57:07 -0400 |
commit | 94905e1db8d8d42c4f39f14dbee2f9788390db5e (patch) | |
tree | 68942735eb1a5b966296c219a5dd0032e01b2cd0 /tools | |
parent | 90efca253973944d7169932820e0bc6419b8cd7b (diff) | |
parent | a60aedfd31722f835dc834f9f2f60882beb96991 (diff) | |
download | u-boot-94905e1db8d8d42c4f39f14dbee2f9788390db5e.zip u-boot-94905e1db8d8d42c4f39f14dbee2f9788390db5e.tar.gz u-boot-94905e1db8d8d42c4f39f14dbee2f9788390db5e.tar.bz2 |
Merge git://git.denx.de/u-boot-dm
Diffstat (limited to 'tools')
-rw-r--r-- | tools/patman/README | 1 | ||||
-rw-r--r-- | tools/patman/func_test.py | 3 | ||||
-rw-r--r-- | tools/patman/gitutil.py | 6 | ||||
-rwxr-xr-x | tools/patman/patman.py | 9 | ||||
-rw-r--r-- | tools/patman/series.py | 5 | ||||
-rw-r--r-- | tools/patman/test.py | 18 |
6 files changed, 35 insertions, 7 deletions
diff --git a/tools/patman/README b/tools/patman/README index 606780e..7917fc8 100644 --- a/tools/patman/README +++ b/tools/patman/README @@ -107,6 +107,7 @@ patman.py. For reference, the useful ones (at the moment) shown below ignore_errors: True process_tags: False verbose: True +smtp_server: /path/to/sendmail <<< diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py index 85372f3..3f7e0321 100644 --- a/tools/patman/func_test.py +++ b/tools/patman/func_test.py @@ -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) diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py index 64ac0c8..9905bb0 100644 --- a/tools/patman/gitutil.py +++ b/tools/patman/gitutil.py @@ -332,7 +332,8 @@ def BuildEmailList(in_list, tag=None, alias=None, raise_on_error=True): return result def EmailPatches(series, cover_fname, args, dry_run, raise_on_error, cc_fname, - self_only=False, alias=None, in_reply_to=None, thread=False): + self_only=False, alias=None, in_reply_to=None, thread=False, + smtp_server=None): """Email a patch series. Args: @@ -348,6 +349,7 @@ def EmailPatches(series, cover_fname, args, dry_run, raise_on_error, cc_fname, Should be a message ID that this is in reply to. thread: True to add --thread to git send-email (make all patches reply to cover-letter or first patch in series) + smtp_server: SMTP server to use to send patches Returns: Git command that was/would be run @@ -405,6 +407,8 @@ def EmailPatches(series, cover_fname, args, dry_run, raise_on_error, cc_fname, to = BuildEmailList([os.getenv('USER')], '--to', alias, raise_on_error) cc = [] cmd = ['git', 'send-email', '--annotate'] + if smtp_server: + cmd.append('--smtp-server=%s' % smtp_server) if in_reply_to: if type(in_reply_to) != str: in_reply_to = in_reply_to.encode('utf-8') diff --git a/tools/patman/patman.py b/tools/patman/patman.py index 8d2c782..27a2feb 100755 --- a/tools/patman/patman.py +++ b/tools/patman/patman.py @@ -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(), @@ -60,6 +62,8 @@ parser.add_option('--no-check', action='store_false', dest='check_patch', help="Don't check for patch compliance") parser.add_option('--no-tags', action='store_false', dest='process_tags', default=True, help="Don't process subject tags as aliaes") +parser.add_option('--smtp-server', type='str', + help="Specify the SMTP server to 'git send-email'") parser.add_option('-T', '--thread', action='store_true', dest='thread', default=False, help='Create patches as a single thread') @@ -157,7 +161,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 = '' @@ -165,7 +169,8 @@ else: if its_a_go: cmd = gitutil.EmailPatches(series, cover_fname, args, options.dry_run, not options.ignore_bad_tags, cc_file, - in_reply_to=options.in_reply_to, thread=options.thread) + in_reply_to=options.in_reply_to, thread=options.thread, + smtp_server=options.smtp_server) else: print(col.Color(col.RED, "Not sending emails due to errors/warnings")) diff --git a/tools/patman/series.py b/tools/patman/series.py index d526d4e..2735afa 100644 --- a/tools/patman/series.py +++ b/tools/patman/series.py @@ -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 diff --git a/tools/patman/test.py b/tools/patman/test.py index c7ba4e6..e1b94bd 100644 --- a/tools/patman/test.py +++ b/tools/patman/test.py @@ -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 <sjg@chromium.org>\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) |