[U-Boot] [PATCH] patman: Support using a particular SMTP server

Simon Glass sjg at chromium.org
Thu Jun 14 21:31:31 UTC 2018


Some environments require providing the '--smtp-server' argument to
'git send-email'. Add support for this.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 tools/patman/README     | 1 +
 tools/patman/gitutil.py | 6 +++++-
 tools/patman/patman.py  | 5 ++++-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/tools/patman/README b/tools/patman/README
index 606780e2ed..7917fc8bdc 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/gitutil.py b/tools/patman/gitutil.py
index 64ac0c8d3d..9905bb0bbd 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 8d2c78235a..143d09e004 100755
--- a/tools/patman/patman.py
+++ b/tools/patman/patman.py
@@ -60,6 +60,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 'get send-email'")
 parser.add_option('-T', '--thread', action='store_true', dest='thread',
                   default=False, help='Create patches as a single thread')
 
@@ -165,7 +167,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"))
 
-- 
2.18.0.rc1.244.gcf134e6275-goog



More information about the U-Boot mailing list