summaryrefslogtreecommitdiffstats
path: root/scripts/contrib
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2017-04-12 22:17:32 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-04-13 10:54:10 +0100
commit11747280b5ca478e9594eae769903e5f6f8f55e2 (patch)
tree90ae44aaf434780cf7f878e63798af1a15b292a7 /scripts/contrib
parentffabe5d1b9539c6cc9fc87ecff9d40f69f8df9be (diff)
downloadpoky-11747280b5ca478e9594eae769903e5f6f8f55e2.tar.gz
oe-build-perf-report-email.py: use pwd for getting user name
Use pwd data instead of os.getlogin() to get the username for fallback email address. os.getlogin() basically returns the name of the user logged in on the controlling terminal of the process and raises an exception on some systems if the process does not have a controlling terminal - when executed from a cron script, for example. (From OE-Core rev: 66b7f495bb000c043ae24176dcdec0cb087eeecf) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/contrib')
-rwxr-xr-xscripts/contrib/oe-build-perf-report-email.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/contrib/oe-build-perf-report-email.py b/scripts/contrib/oe-build-perf-report-email.py
index 055a7b12cf..261ca514e5 100755
--- a/scripts/contrib/oe-build-perf-report-email.py
+++ b/scripts/contrib/oe-build-perf-report-email.py
@@ -211,9 +211,10 @@ def send_email(text_fn, html_fn, subject, recipients):
211 else: 211 else:
212 raise ReportError("Neither plain text nor html body specified") 212 raise ReportError("Neither plain text nor html body specified")
213 213
214 full_name = pwd.getpwuid(os.getuid()).pw_gecos.split(',')[0] 214 pw_data = pwd.getpwuid(os.getuid())
215 full_name = pw_data.pw_gecos.split(',')[0]
215 email = os.environ.get('EMAIL', 216 email = os.environ.get('EMAIL',
216 '{}@{}'.format(os.getlogin(), socket.getfqdn())) 217 '{}@{}'.format(pw_data.pw_name, socket.getfqdn()))
217 msg['From'] = "{} <{}>".format(full_name, email) 218 msg['From'] = "{} <{}>".format(full_name, email)
218 msg['To'] = ', '.join(recipients) 219 msg['To'] = ', '.join(recipients)
219 msg['Subject'] = subject 220 msg['Subject'] = subject