diff options
| author | Joshua Lock <joshua.g.lock@intel.com> | 2017-09-21 11:18:34 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-09-21 23:16:55 +0100 |
| commit | eac8a5cf4212feaf8baf230e9ae991939732141d (patch) | |
| tree | 3d6caaa66536049e36b833a6cba9984b322dc9cc /scripts/contrib/oe-build-perf-report-email.py | |
| parent | b32174e58e89119e3ca2315030629a6580ccbd52 (diff) | |
| download | poky-eac8a5cf4212feaf8baf230e9ae991939732141d.tar.gz | |
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>
Diffstat (limited to 'scripts/contrib/oe-build-perf-report-email.py')
| -rwxr-xr-x | scripts/contrib/oe-build-perf-report-email.py | 17 |
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 | ||
| 191 | def send_email(text_fn, html_fn, subject, recipients): | 195 | def 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 |
