[yocto] [[AUH] PATCHv2 13/13] upgradehelper.py: Add support for preserve emails.

Aníbal Limón anibal.limon at linux.intel.com
Wed Nov 11 14:34:29 PST 2015


This support is useful for review purposes after upgrade process
and these emails are saved into recipe work directory.

Signed-off-by: Aníbal Limón <anibal.limon at linux.intel.com>
---
 upgradehelper.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/upgradehelper.py b/upgradehelper.py
index f7ce425..5eb9f5a 100755
--- a/upgradehelper.py
+++ b/upgradehelper.py
@@ -413,6 +413,20 @@ class Updater(object):
         if self.send_email and not err:
             self.email_handler.send_email(to_addr, subject, msg_body, attachments, cc_addr=cc_addr)
 
+        # Preserve email for review purposes.
+        email_file = os.path.join(self.uh_work_dir,
+                    "email_summary")
+        with open(email_file, "w+") as f:
+            f.write("To: %s\n" % to_addr)
+            if isinstance(cc_addr, list):
+                f.write("To: %s\n" % ' '.join(to_addr))
+            else:
+                f.write("Cc: %s\n" % to_addr)
+
+            f.write("Subject: %s\n" % subject)
+            f.write("Attachments: %s\n" % ' '.join(attachments))
+            f.write("\n%s\n" % msg_body)
+
     def _commit_changes(self):
         try:
             self.patch_file = None
-- 
2.1.4




More information about the yocto mailing list