mirror of
https://git.yoctoproject.org/poky
synced 2026-06-03 01:40:07 +00:00
oe-build-perf-report-email.py: add cc and bcc options
Enable carbon copy and blind carbon copy recipients for the performance report emails. (From OE-Core rev: df5ae8143ff1764b6ed5973ed3d6f1a83ecf45ee) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
b32174e58e
commit
eac8a5cf42
@@ -71,6 +71,10 @@ def parse_args(argv):
|
|||||||
help="Only print errors")
|
help="Only print errors")
|
||||||
parser.add_argument('--to', action='append',
|
parser.add_argument('--to', action='append',
|
||||||
help="Recipients of the email")
|
help="Recipients of the email")
|
||||||
|
parser.add_argument('--cc', action='append',
|
||||||
|
help="Carbon copy recipients of the email")
|
||||||
|
parser.add_argument('--bcc', action='append',
|
||||||
|
help="Blind carbon copy recipients of the email")
|
||||||
parser.add_argument('--subject', default="Yocto build perf test report",
|
parser.add_argument('--subject', default="Yocto build perf test report",
|
||||||
help="Email subject")
|
help="Email subject")
|
||||||
parser.add_argument('--outdir', '-o',
|
parser.add_argument('--outdir', '-o',
|
||||||
@@ -188,7 +192,7 @@ def scrape_html_report(report, outdir, phantomjs_extra_args=None):
|
|||||||
finally:
|
finally:
|
||||||
shutil.rmtree(tmpdir)
|
shutil.rmtree(tmpdir)
|
||||||
|
|
||||||
def send_email(text_fn, html_fn, subject, recipients):
|
def send_email(text_fn, html_fn, subject, recipients, copy=[], blind_copy=[]):
|
||||||
"""Send email"""
|
"""Send email"""
|
||||||
# Generate email message
|
# Generate email message
|
||||||
text_msg = html_msg = None
|
text_msg = html_msg = None
|
||||||
@@ -217,6 +221,10 @@ def send_email(text_fn, html_fn, subject, recipients):
|
|||||||
'{}@{}'.format(pw_data.pw_name, socket.getfqdn()))
|
'{}@{}'.format(pw_data.pw_name, socket.getfqdn()))
|
||||||
msg['From'] = "{} <{}>".format(full_name, email)
|
msg['From'] = "{} <{}>".format(full_name, email)
|
||||||
msg['To'] = ', '.join(recipients)
|
msg['To'] = ', '.join(recipients)
|
||||||
|
if copy:
|
||||||
|
msg['Cc'] = ', '.join(copy)
|
||||||
|
if blind_copy:
|
||||||
|
msg['Bcc'] = ', '.join(blind_copy)
|
||||||
msg['Subject'] = subject
|
msg['Subject'] = subject
|
||||||
|
|
||||||
# Send email
|
# Send email
|
||||||
@@ -250,7 +258,12 @@ def main(argv=None):
|
|||||||
|
|
||||||
if args.to:
|
if args.to:
|
||||||
log.info("Sending email to %s", ', '.join(args.to))
|
log.info("Sending email to %s", ', '.join(args.to))
|
||||||
send_email(args.text, html_report, args.subject, args.to)
|
if args.cc:
|
||||||
|
log.info("Copying to %s", ', '.join(args.cc))
|
||||||
|
if args.bcc:
|
||||||
|
log.info("Blind copying to %s", ', '.join(args.bcc))
|
||||||
|
send_email(args.text, html_report, args.subject,
|
||||||
|
args.to, args.cc, args.bcc)
|
||||||
except subprocess.CalledProcessError as err:
|
except subprocess.CalledProcessError as err:
|
||||||
log.error("%s, with output:\n%s", str(err), err.output.decode())
|
log.error("%s, with output:\n%s", str(err), err.output.decode())
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
Reference in New Issue
Block a user