[yocto] [PATCH 05/11][auh] upgrade_helper.py: Make notice of License change into email.

Aníbal Limón anibal.limon at linux.intel.com
Wed Jun 10 09:28:46 PDT 2015


When license change it need to be specified into email to maintainers
for review it.

Add get_license_diff_file_name method to recipe class for get it
into email handler and write information about it.

[YOCTO 7186]

Signed-off-by: Aníbal Limón <anibal.limon at linux.intel.com>
---
 recipe.py        |  7 +++++++
 upgradehelper.py | 53 ++++++++++++++++++++++++++++++-----------------------
 2 files changed, 37 insertions(+), 23 deletions(-)

diff --git a/recipe.py b/recipe.py
index 8ecd2a2..55eb5bf 100644
--- a/recipe.py
+++ b/recipe.py
@@ -394,6 +394,13 @@ class Recipe(object):
 
         return False
 
+    def get_license_diff_file_name(self):
+        file_name = None
+        if not self.license_diff_file is None:
+            file_name = os.path.basename(self.license_diff_file)
+
+        return file_name
+
     def _get_failed_recipes(self, output):
         failed_tasks = dict()
         machine = None
diff --git a/upgradehelper.py b/upgradehelper.py
index 74f9c0a..953f86e 100755
--- a/upgradehelper.py
+++ b/upgradehelper.py
@@ -124,26 +124,6 @@ def parse_config_file(config_file):
     return (settings, maintainer_override)
 
 class Updater(object):
-    mail_header = \
-        "Hello,\n\nYou are receiving this email because you are the maintainer\n" \
-        "of *%s* recipe and this is to let you know that the automatic attempt\n" \
-        "to upgrade the recipe to *%s* has %s.\n\n"
-
-    next_steps_info = \
-        "The recipe has been successfully compiled for all major architectures.\n\n" \
-        "Next steps:\n" \
-        "    - apply the patch: git am %s\n" \
-        "    - check that required patches have not been removed from the recipe\n" \
-        "    - compile an image that contains the package\n" \
-        "    - perform some basic sanity tests\n" \
-        "    - amend the patch and sign it off: git commit -s --reset-author --amend\n" \
-        "    - send it to the list\n\n" \
-
-    mail_footer = \
-        "Attached are the patch and the logs (+ license file diff) in case of failure.\n\n" \
-        "Regards,\nThe Upgrade Helper"
-
-
     def __init__(self, auto_mode=False, send_email=False, skip_compilation=False):
 
         self.uh_dir = get_build_dir() + "/upgrade-helper"
@@ -375,6 +355,29 @@ class Updater(object):
             self.git.clean_untracked()
 
         if self.send_email:
+            mail_header = \
+                "Hello,\n\nYou are receiving this email because you are the maintainer\n" \
+                "of *%s* recipe and this is to let you know that the automatic attempt\n" \
+                "to upgrade the recipe to *%s* has %s.\n\n"
+
+            license_change_info = \
+                "*LICENSE CHANGED* please review the %s file and update the LICENSE\n" \
+                "variable in the recipe if is needed.\n\n"
+
+            next_steps_info = \
+                "The recipe has been successfully compiled for all major architectures.\n\n" \
+                "Next steps:\n" \
+                "    - apply the patch: git am %s\n" \
+                "    - check that required patches have not been removed from the recipe\n" \
+                "    - compile an image that contains the package\n" \
+                "    - perform some basic sanity tests\n" \
+                "    - amend the patch and sign it off: git commit -s --reset-author --amend\n" \
+                "    - send it to the list\n\n" \
+
+            mail_footer = \
+                "Attached are the patch, license diff (if change) and bitbake log.\n\n" \
+                "Regards,\nThe Upgrade Helper"
+
             # don't bother maintainer with mail if the recipe is already up to date
             if status == "UpgradeNotNeededError":
                 return
@@ -390,13 +393,17 @@ class Updater(object):
             else:
                 subject += " FAILED"
 
-            msg_body = self.mail_header % (self.pn, self.new_ver,
+            msg_body = mail_header % (self.pn, self.new_ver,
                     self._get_status_msg(err))
 
+            license_diff_fn = self.recipe.get_license_diff_file_name()
+            if license_diff_fn:
+                msg_body += license_change_info % license_diff_fn
+
             if err is None:
-                msg_body += self.next_steps_info % os.path.basename(self.patch_file)
+                msg_body += next_steps_info % os.path.basename(self.patch_file)
 
-            msg_body += self.mail_footer
+            msg_body += mail_footer
 
             # Add possible attachments to email
             attachments = []
-- 
1.8.4.5




More information about the yocto mailing list