[rtems-tools commit] rtems-bsp-builder: Fix mail support
Joel Sherrill
joel at rtems.org
Thu Dec 16 21:26:47 UTC 2021
Module: rtems-tools
Branch: 5
Commit: bdd785a39769d0b59a651171e98532d6783a283a
Changeset: http://git.rtems.org/rtems-tools/commit/?id=bdd785a39769d0b59a651171e98532d6783a283a
Author: Alex White <alex.white at oarcorp.com>
Date: Thu Oct 28 14:58:37 2021 -0500
rtems-bsp-builder: Fix mail support
This fixes a problem with mailer options support that occurred because
check.py uses argparse.ArgumentParser instead of tester.rt.options.
Closes #4553
---
rtemstoolkit/mailer.py | 5 +++--
tester/rt/check.py | 17 ++++++++++++++++-
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/rtemstoolkit/mailer.py b/rtemstoolkit/mailer.py
index ae51d78..09e4a26 100644
--- a/rtemstoolkit/mailer.py
+++ b/rtemstoolkit/mailer.py
@@ -61,14 +61,15 @@ def append_options(opts):
def add_arguments(argsp):
argsp.add_argument('--mail', help = _options['--mail'], action = 'store_true')
argsp.add_argument('--use-gitconfig', help = _options['--use-gitconfig'], action = 'store_true')
- for o in list(_options)[1:]:
+ no_add = ['--mail', '--use-gitconfig']
+ for o in [opt for opt in list(_options) if opt not in no_add]:
argsp.add_argument(o, help = _options[o], type = str)
class mail:
def __init__(self, opts):
self.opts = opts
self.gitconfig_lines = None
- if opts.find_arg('--use-gitconfig') is not None:
+ if self._get_arg('--use-gitconfig'):
# Read the output of `git config --list` instead of reading the
# .gitconfig file directly because Python 2 ConfigParser does not
# accept tabs at the beginning of lines.
diff --git a/tester/rt/check.py b/tester/rt/check.py
index 2a38d99..deac19d 100755
--- a/tester/rt/check.py
+++ b/tester/rt/check.py
@@ -105,7 +105,22 @@ def title():
return 'RTEMS Tools Project - RTEMS Kernel BSP Builder, %s' % (version.string())
def command_line():
- return wrap(('command: ', ' '.join(sys.argv)), lineend = '\\')
+ # Filter potentially sensitive mail options out.
+ filtered_args = [
+ arg for arg in sys.argv
+ if all(
+ smtp_opt not in arg
+ for smtp_opt in [
+ '--smtp-host',
+ '--mail-to',
+ '--mail-from',
+ '--smtp-user',
+ '--smtp-password',
+ '--smtp-port'
+ ]
+ )
+ ]
+ return wrap(('command: ', ' '.join(filtered_args)), lineend = '\\')
def jobs_option_parse(jobs_option):
try:
More information about the vc
mailing list