summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/contrib/oe-build-perf-report-email.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/scripts/contrib/oe-build-perf-report-email.py b/scripts/contrib/oe-build-perf-report-email.py
index 261ca514e5..64e85c26ad 100755
--- a/scripts/contrib/oe-build-perf-report-email.py
+++ b/scripts/contrib/oe-build-perf-report-email.py
@@ -71,6 +71,10 @@ def parse_args(argv):
71 help="Only print errors") 71 help="Only print errors")
72 parser.add_argument('--to', action='append', 72 parser.add_argument('--to', action='append',
73 help="Recipients of the email") 73 help="Recipients of the email")
74 parser.add_argument('--cc', action='append',
75 help="Carbon copy recipients of the email")
76 parser.add_argument('--bcc', action='append',
77 help="Blind carbon copy recipients of the email")
74 parser.add_argument('--subject', default="Yocto build perf test report", 78 parser.add_argument('--subject', default="Yocto build perf test report",
75 help="Email subject") 79 help="Email subject")
76 parser.add_argument('--outdir', '-o', 80 parser.add_argument('--outdir', '-o',
@@ -188,7 +192,7 @@ def scrape_html_report(report, outdir, phantomjs_extra_args=None):
188 finally: 192 finally:
189 shutil.rmtree(tmpdir) 193 shutil.rmtree(tmpdir)
190 194
191def send_email(text_fn, html_fn, subject, recipients): 195def send_email(text_fn, html_fn, subject, recipients, copy=[], blind_copy=[]):
192 """Send email""" 196 """Send email"""
193 # Generate email message 197 # Generate email message
194 text_msg = html_msg = None 198 text_msg = html_msg = None
@@ -217,6 +221,10 @@ def send_email(text_fn, html_fn, subject, recipients):
217 '{}@{}'.format(pw_data.pw_name, socket.getfqdn())) 221 '{}@{}'.format(pw_data.pw_name, socket.getfqdn()))
218 msg['From'] = "{} <{}>".format(full_name, email) 222 msg['From'] = "{} <{}>".format(full_name, email)
219 msg['To'] = ', '.join(recipients) 223 msg['To'] = ', '.join(recipients)
224 if copy:
225 msg['Cc'] = ', '.join(copy)
226 if blind_copy:
227 msg['Bcc'] = ', '.join(blind_copy)
220 msg['Subject'] = subject 228 msg['Subject'] = subject
221 229
222 # Send email 230 # Send email
@@ -250,7 +258,12 @@ def main(argv=None):
250 258
251 if args.to: 259 if args.to:
252 log.info("Sending email to %s", ', '.join(args.to)) 260 log.info("Sending email to %s", ', '.join(args.to))
253 send_email(args.text, html_report, args.subject, args.to) 261 if args.cc:
262 log.info("Copying to %s", ', '.join(args.cc))
263 if args.bcc:
264 log.info("Blind copying to %s", ', '.join(args.bcc))
265 send_email(args.text, html_report, args.subject,
266 args.to, args.cc, args.bcc)
254 except subprocess.CalledProcessError as err: 267 except subprocess.CalledProcessError as err:
255 log.error("%s, with output:\n%s", str(err), err.output.decode()) 268 log.error("%s, with output:\n%s", str(err), err.output.decode())
256 return 1 269 return 1