All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aníbal Limón" <anibal.limon@linux.intel.com>
To: yocto@yoctoproject.org
Cc: paul.eggleton@linux.intel.com
Subject: [PATCH 01/11][auh] upgradehelper.py: Fix status_msg in pkg_upgrade_handler
Date: Wed, 10 Jun 2015 16:28:42 +0000	[thread overview]
Message-ID: <1433953732-29963-2-git-send-email-anibal.limon@linux.intel.com> (raw)
In-Reply-To: <1433953732-29963-1-git-send-email-anibal.limon@linux.intel.com>

When is called pkg_upgrade_handler for generate email and save
build history at end sometimes status_msg is undefined.

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

diff --git a/upgradehelper.py b/upgradehelper.py
index ddd0835..366efb3 100755
--- a/upgradehelper.py
+++ b/upgradehelper.py
@@ -173,8 +173,6 @@ class Updater(object):
         self.email_handler = Email(settings)
         self.statistics = Statistics()
 
-
-
     def _get_env(self):
         stdout = self.bb.env(self.pn)
 
@@ -217,6 +215,11 @@ class Updater(object):
         self.recipe = recipe(self.env, self.new_ver, self.interactive, self.workdir,
                              self.recipe_dir, self.bb, self.git)
 
+    def _get_status_msg(self, err):
+        if err:
+            return str(err)
+        else:
+            return "Succeeded"
 
     def _create_workdir(self):
         self.workdir = self.uh_dir + "/" + self.pn
@@ -344,7 +347,6 @@ class Updater(object):
     def pkg_upgrade_handler(self, err):
         if err and self.patch_file:
             answer = "N"
-            status_msg = str(err)
             if self.interactive:
                 I(" %s: Do you want to keep the changes? (y/N)" % self.pn)
                 answer = sys.stdin.readline().strip().upper()
@@ -354,8 +356,6 @@ class Updater(object):
                 self.git.reset_hard(1)
                 self.git.clean_untracked()
                 return
-        elif not err:
-            status_msg = "Succeeded"
 
         status = type(err).__name__
 
@@ -384,7 +384,8 @@ class Updater(object):
             else:
                 subject += " FAILED"
 
-            msg_body = self.mail_header % (self.pn, self.new_ver, status_msg)
+            msg_body = self.mail_header % (self.pn, self.new_ver,
+                    self._get_status_msg(err))
 
             if err is None:
                 msg_body += self.next_steps_info % os.path.basename(self.patch_file)
@@ -653,7 +654,8 @@ class UniverseUpdater(Updater):
     # overriding the base method
     def pkg_upgrade_handler(self, err):
         super(UniverseUpdater, self).pkg_upgrade_handler(self)
-        self.update_history(self.pn, self.new_ver, self.maintainer, status_msg)
+        self.update_history(self.pn, self.new_ver, self.maintainer,
+                self._get_status_msg(err))
 
     def run(self):
         self.update_master()
-- 
1.8.4.5



  reply	other threads:[~2015-06-10 16:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-10 16:28 [PATCH 00/11][auh]: Add support of new upstream mechanism and improvments Aníbal Limón
2015-06-10 16:28 ` Aníbal Limón [this message]
2015-06-10 16:28 ` [PATCH 02/11][auh] upgradehelper.py: Make usage of new upstream detection mechanism Aníbal Limón
2015-06-10 16:28 ` [PATCH 03/11][auh] upgradehelper.py: Use settings.from as email for commits Aníbal Limón
2015-06-10 16:28 ` [PATCH 04/11][auh] upgradehelper.py: Improve usage when try to upgrade one recipe Aníbal Limón
2015-06-10 16:28 ` [PATCH 05/11][auh] upgrade_helper.py: Make notice of License change into email Aníbal Limón
2015-06-10 16:28 ` [PATCH 06/11][auh] upgradehelper.py: Add specific information about machines build succeed Aníbal Limón
2015-06-10 16:28 ` [PATCH 07/11][auh] upgradehelper.py: Move recipe work into upgradehelper work dir Aníbal Limón
2015-06-10 16:28 ` [PATCH 08/11][auh] upgradehelper.py: Fix interactive mode when recipe upgrade finish Aníbal Limón
2015-06-10 16:28 ` [PATCH 09/11][auh] upgradehelper.py: Change policy for send emails and fix error passing Aníbal Limón
2015-06-11 20:51   ` Paul Eggleton
2015-06-11 20:56     ` Aníbal Limón
2015-06-11 21:05       ` Paul Eggleton
2015-06-11 21:18         ` Aníbal Limón
2015-06-10 16:28 ` [PATCH 10/11][auh] upgradehelper.py: Change print to logger info Aníbal Limón
2015-06-10 16:28 ` [PATCH 11/11][auh] README: Edit Maintainece section to add current maintainer Aníbal Limón

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1433953732-29963-2-git-send-email-anibal.limon@linux.intel.com \
    --to=anibal.limon@linux.intel.com \
    --cc=paul.eggleton@linux.intel.com \
    --cc=yocto@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.