mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00
sb: Merge mailer changes from rtems-tools
This adds the improved mailer.py script from rtems-tools. Closes #4388
This commit is contained in:

committed by
Joel Sherrill

parent
774b5fcec2
commit
4e6dc64314
@@ -517,6 +517,15 @@ class command_line:
|
||||
return None
|
||||
return self.parse_args(arg)
|
||||
|
||||
def find_arg(self, arg):
|
||||
if self.optargs is None or arg not in self.optargs:
|
||||
raise error.internal('bad arg: %s' % (arg))
|
||||
for a in self.args:
|
||||
sa = a.split('=')
|
||||
if sa[0].startswith(arg):
|
||||
return sa
|
||||
return None
|
||||
|
||||
def with_arg(self, label, default = 'not-found'):
|
||||
# the default if there is no option for without.
|
||||
result = default
|
||||
@@ -582,7 +591,22 @@ class command_line:
|
||||
self.opts['no-install'] = '1'
|
||||
|
||||
def info(self):
|
||||
s = ' Command Line: %s%s' % (' '.join(self.argv), os.linesep)
|
||||
# Filter potentially sensitive mail options out.
|
||||
filtered_args = [
|
||||
arg for arg in self.argv
|
||||
if all(
|
||||
smtp_opt not in arg
|
||||
for smtp_opt in [
|
||||
'--smtp-host',
|
||||
'--mail-to',
|
||||
'--mail-from',
|
||||
'--smtp-user',
|
||||
'--smtp-password',
|
||||
'--smtp-port'
|
||||
]
|
||||
)
|
||||
]
|
||||
s = ' Command Line: %s%s' % (' '.join(filtered_args), os.linesep)
|
||||
s += ' Python: %s' % (sys.version.replace('\n', ''))
|
||||
return s
|
||||
|
||||
|
Reference in New Issue
Block a user