All of lore.kernel.org
 help / color / mirror / Atom feed
* [yocto-autobuilder][PATCH] SendQAEmail.py: use sendmail instead of mail to send QA email
@ 2016-08-09 16:42 Bill Randle
  2016-08-10  7:12 ` Beth 'pidge' Flanagan
  0 siblings, 1 reply; 2+ messages in thread
From: Bill Randle @ 2016-08-09 16:42 UTC (permalink / raw)
  To: yocto

When sending QA emails, the autobuilder uses the 'mail' command (typically
installed as /usr/bin/mail or /bin/mail). However, most distributions do not
install this program by default. They generally always install the 'sendmail'
program, though, so use 'sendmail' as the mail agent, rather than 'mail'.

[YOCTO #10082]

Signed-off-by: Bill Randle <william.c.randle@intel.com>
---
 .../autobuilder/buildsteps/SendQAEmail.py          | 26 ++++++++++++----------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/lib/python2.7/site-packages/autobuilder/buildsteps/SendQAEmail.py b/lib/python2.7/site-packages/autobuilder/buildsteps/SendQAEmail.py
index 0cd76d5..3691cc6 100644
--- a/lib/python2.7/site-packages/autobuilder/buildsteps/SendQAEmail.py
+++ b/lib/python2.7/site-packages/autobuilder/buildsteps/SendQAEmail.py
@@ -47,9 +47,9 @@ class SendQAEmail(ShellCommand):
             properties = self.build.getProperties().asDict()
             repoprops = {}
             mailsubject = "Build available for QA"
-            email_header = '''
-    A build identified as needing QA has finished on the autobuilder. This
-    build is located at:\n\n
+            email_base = '''
+A build identified as needing QA has finished on the autobuilder. This
+build is located at:\n\n
     %s''' % (self.getProperty('DEST').replace(web_root, web_url))
 
             if str(self.getProperty("custom_release_me")) == "True":
@@ -68,9 +68,9 @@ class SendQAEmail(ShellCommand):
                 poky_number = self.getProperty("custom_poky_number")+prefix
                 yocto_number = self.getProperty("custom_yocto_number")+prefix
                 rel_name = 'yocto-'+ yocto_number
-                email_header = '''
+                email_base = '''
 A release candidate build for %s is now available at:\n\n
-%s\n\n
+    %s\n\n
 Please begin QA on this build as soon as possible.''' % (rel_name, self.getProperty('DEST').replace(web_root, web_url))
                 mailsubject = "Release Candidate Build for " + rel_name + snapshot + " now available."
 
@@ -85,16 +85,18 @@ Please begin QA on this build as soon as possible.''' % (rel_name, self.getPrope
             for k, v in repoprops.iteritems():
                 email_body = email_body + '%s : %s \n' % (k, v[1])
 
-            mailcmd = 'echo -e "' + email_header + '\n' + email_body + '\n' + mailsig + ' " | mail -s \'' + mailsubject + '\''
-
+            email_header = ""
+            if mailto is not None and mailto is not "":
+                email_header += "To: " + mailto + "\n"
             if mailcc is not None and mailcc is not "":
-                mailcmd += " -c '" + mailcc + "' "
-
+                email_header += "Cc: " + mailcc + "\n"
             if mailbcc is not None and mailbcc is not "":
-                mailcmd += " -b '" + mailbcc + "' "
+                email_header += "Bcc: " + mailbcc + "\n"
+
+            email_header += "Subject: " + mailsubject + "\n"
+
+            mailcmd = 'echo -e "' + email_header + "\n" + email_base + '\n' + email_body + '\n' + mailsig + ' " | sendmail -t'
 
-            if mailto is not None and mailto is not "":
-                mailcmd += " '" + mailto + "' "
             self.command = mailcmd
         else:
             self.command = 'echo "Not a QA build"'
-- 
2.5.5



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [yocto-autobuilder][PATCH] SendQAEmail.py: use sendmail instead of mail to send QA email
  2016-08-09 16:42 [yocto-autobuilder][PATCH] SendQAEmail.py: use sendmail instead of mail to send QA email Bill Randle
@ 2016-08-10  7:12 ` Beth 'pidge' Flanagan
  0 siblings, 0 replies; 2+ messages in thread
From: Beth 'pidge' Flanagan @ 2016-08-10  7:12 UTC (permalink / raw)
  To: Bill Randle, yocto

Merged into master,

Thanks
-b

On Tue, 2016-08-09 at 09:42 -0700, Bill Randle wrote:
> When sending QA emails, the autobuilder uses the 'mail' command
> (typically
> installed as /usr/bin/mail or /bin/mail). However, most distributions
> do not
> install this program by default. They generally always install the
> 'sendmail'
> program, though, so use 'sendmail' as the mail agent, rather than
> 'mail'.
> 
> [YOCTO #10082]
> 
> Signed-off-by: Bill Randle <william.c.randle@intel.com>
> ---
>  .../autobuilder/buildsteps/SendQAEmail.py          | 26
> ++++++++++++----------
>  1 file changed, 14 insertions(+), 12 deletions(-)
> 
> diff --git a/lib/python2.7/site-
> packages/autobuilder/buildsteps/SendQAEmail.py b/lib/python2.7/site-
> packages/autobuilder/buildsteps/SendQAEmail.py
> index 0cd76d5..3691cc6 100644
> --- a/lib/python2.7/site-
> packages/autobuilder/buildsteps/SendQAEmail.py
> +++ b/lib/python2.7/site-
> packages/autobuilder/buildsteps/SendQAEmail.py
> @@ -47,9 +47,9 @@ class SendQAEmail(ShellCommand):
>              properties = self.build.getProperties().asDict()
>              repoprops = {}
>              mailsubject = "Build available for QA"
> -            email_header = '''
> -    A build identified as needing QA has finished on the
> autobuilder. This
> -    build is located at:\n\n
> +            email_base = '''
> +A build identified as needing QA has finished on the autobuilder.
> This
> +build is located at:\n\n
>      %s''' % (self.getProperty('DEST').replace(web_root, web_url))
>  
>              if str(self.getProperty("custom_release_me")) == "True":
> @@ -68,9 +68,9 @@ class SendQAEmail(ShellCommand):
>                  poky_number =
> self.getProperty("custom_poky_number")+prefix
>                  yocto_number =
> self.getProperty("custom_yocto_number")+prefix
>                  rel_name = 'yocto-'+ yocto_number
> -                email_header = '''
> +                email_base = '''
>  A release candidate build for %s is now available at:\n\n
> -%s\n\n
> +    %s\n\n
>  Please begin QA on this build as soon as possible.''' % (rel_name,
> self.getProperty('DEST').replace(web_root, web_url))
>                  mailsubject = "Release Candidate Build for " +
> rel_name + snapshot + " now available."
>  
> @@ -85,16 +85,18 @@ Please begin QA on this build as soon as
> possible.''' % (rel_name, self.getPrope
>              for k, v in repoprops.iteritems():
>                  email_body = email_body + '%s : %s \n' % (k, v[1])
>  
> -            mailcmd = 'echo -e "' + email_header + '\n' + email_body
> + '\n' + mailsig + ' " | mail -s \'' + mailsubject + '\''
> -
> +            email_header = ""
> +            if mailto is not None and mailto is not "":
> +                email_header += "To: " + mailto + "\n"
>              if mailcc is not None and mailcc is not "":
> -                mailcmd += " -c '" + mailcc + "' "
> -
> +                email_header += "Cc: " + mailcc + "\n"
>              if mailbcc is not None and mailbcc is not "":
> -                mailcmd += " -b '" + mailbcc + "' "
> +                email_header += "Bcc: " + mailbcc + "\n"
> +
> +            email_header += "Subject: " + mailsubject + "\n"
> +
> +            mailcmd = 'echo -e "' + email_header + "\n" + email_base
> + '\n' + email_body + '\n' + mailsig + ' " | sendmail -t'
>  
> -            if mailto is not None and mailto is not "":
> -                mailcmd += " '" + mailto + "' "
>              self.command = mailcmd
>          else:
>              self.command = 'echo "Not a QA build"'


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-10  7:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-09 16:42 [yocto-autobuilder][PATCH] SendQAEmail.py: use sendmail instead of mail to send QA email Bill Randle
2016-08-10  7:12 ` Beth 'pidge' Flanagan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.