upgradehelper.py: Change policy for send emails and fix error handling.
PATCH v3 9/11 upgradehelper.py: Change policy for send emails and fix error handling.
Add MaintainerError class for identify errors that can be hanlded by Maintainers, only send emails when error is instance of MaintainerError.
Get rid of UpgradeNotNeededError when run steps now is handled by new upstream version detection only load recipes that need update.
[YOCTO #7489]
--- errors.py | 16 ++++++++++++---- upgradehelper.py | 16 +++++++--------- 2 files changed, 19 insertions(+), 13 deletions(-)
errors.py +12 -4
@@ -31,6 +31,11 @@ class Error(Exception): def __str__(self): return "Failed(other errors)" +class MaintainerError(Error): + """ Class for group error that can be sent to Maintainer's """ + def __init__(self, message=None, stdout=None, stderr=None): + super(MaintainerError, self).__init__(message, stdout, stderr) + class FetchError(Error): def __init__(self): super(FetchError, self).__init__("do_fetch failed")
@@ -38,25 +43,28 @@ class FetchError(Error): def __str__(self): return "Failed(do_fetch)" -class PatchError(Error): +class PatchError(MaintainerError): def __init__(self): super(PatchError, self).__init__("do_patch failed") def __str__(self): return "Failed(do_patch)" -class ConfigureError(Error): +class ConfigureError(MaintainerError): def __init__(self): super(ConfigureError, self).__init__("do_configure failed") -class CompilationError(Error): + def __str__(self): + return "Failed(do_configure)" + +class CompilationError(MaintainerError): def __init__(self): super(CompilationError, self).__init__("do_compile failed") def __str__(self): return "Failed(do_compile)" -class LicenseError(Error): +class LicenseError(MaintainerError): def __init__(self): super(LicenseError, self).__init__("license checksum does not match")
upgradehelper.py +7 -9
@@ -346,8 +346,6 @@ class Updater(object): self.git.clean_untracked() return - status = type(err).__name__ - # drop last upgrade from git. It's safer this way if the upgrade has # problems and other recipes depend on it. Give the other recipes a # chance...
@@ -381,8 +379,11 @@ class Updater(object): "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": + # only send email to Maintainer when is an error that can handle + if err and not isinstance(err, MaintainerError): + D( "%s: Don't send email to maintainer because the error was " \ + "%s and the information isn't useful, please review it." \ + % (self.pn, type(err).__name__)) return if self.maintainer in maintainer_override:
@@ -478,6 +479,7 @@ class Updater(object): attempted_pkgs = 0 for self.pn, self.new_ver, self.maintainer in pkgs_to_upgrade: + error = None self.recipe = None attempted_pkgs += 1 I(" ATTEMPT PACKAGE %d/%d" % (attempted_pkgs, total_pkgs))
@@ -489,10 +491,6 @@ class Updater(object): step() I(" %s: Upgrade SUCCESSFUL! Please test!" % self.pn) - error = None - except UpgradeNotNeededError as e: - I(" %s: %s" % (self.pn, e.message)) - error = e except Error as e: E(" %s: %s" % (self.pn, e.message)) E(" %s: Upgrade FAILED! Logs and/or file diffs are available in %s" % (self.pn, self.workdir))
@@ -667,7 +665,7 @@ class UniverseUpdater(Updater): # overriding the base method def pkg_upgrade_handler(self, err): - super(UniverseUpdater, self).pkg_upgrade_handler(self) + super(UniverseUpdater, self).pkg_upgrade_handler(err) self.update_history(self.pn, self.new_ver, self.maintainer, self._get_status_msg(err))
Signature · 1 line
1.8.4.5
Quoted 115 lines · On Wednesday 17 June 2015 00:35:18 Aníbal Limón wrote:
Add MaintainerError class for identify errors that can be hanlded by Maintainers, only send emails when error is instance of MaintainerError.
Get rid of UpgradeNotNeededError when run steps now is handled by new upstream version detection only load recipes that need update.
[YOCTO #7489]
Signed-off-by Aníbal Limón <[email protected]>--- errors.py | 16 ++++++++++++---- upgradehelper.py | 16 +++++++--------- 2 files changed, 19 insertions(+), 13 deletions(-)errors.py +12
-4@@ -31,6 +31,11 @@ class Error(Exception): def __str__(self): return "Failed(other errors)" +class MaintainerError(Error): + """ Class for group error that can be sent to Maintainer's """ + def __init__(self, message=None, stdout=None, stderr=None): + super(MaintainerError, self).__init__(message, stdout, stderr) + class FetchError(Error): def __init__(self): super(FetchError, self).__init__("do_fetch failed")@@ -38,25 +43,28 @@ class FetchError(Error): def __str__(self): return "Failed(do_fetch)" -class PatchError(Error): +class PatchError(MaintainerError): def __init__(self): super(PatchError, self).__init__("do_patch failed") def __str__(self): return "Failed(do_patch)" -class ConfigureError(Error): +class ConfigureError(MaintainerError): def __init__(self): super(ConfigureError, self).__init__("do_configure failed") -class CompilationError(Error): + def __str__(self): + return "Failed(do_configure)" + +class CompilationError(MaintainerError): def __init__(self): super(CompilationError, self).__init__("do_compile failed") def __str__(self): return "Failed(do_compile)" -class LicenseError(Error): +class LicenseError(MaintainerError): def __init__(self): super(LicenseError, self).__init__("license checksum does not match")upgradehelper.py +0
-2@@ -346,8 +346,6 @@ class Updater(object): self.git.clean_untracked() return - status = type(err).__name__ - # drop last upgrade from git. It's safer this way if the upgradehas # problems and other recipes depend on it. Give the other recipes a # chance...
upgradehelper.py +0
-0@@ -381,8 +379,11 @@ class Updater(object): "Attached are the patch, license diff (if change) andbitbake log.\n\n" \ "Regards,\nThe Upgrade Helper"
- # don't bother maintainer with mail if the recipe is already up
to date - if status == "UpgradeNotNeededError":
+ # only send email to Maintainer when is an error that can
handle + if err and notisinstance(err, MaintainerError):
+ D( "%s: Don't send email to maintainer because the error
was " \ + "%s and the information isn't useful, please
review it." \ + % (self.pn, type(err).__name__))
returnif self.maintainer in
maintainer_override:upgradehelper.py +1
-4@@ -478,6 +479,7 @@ class Updater(object): attempted_pkgs = 0 for self.pn, self.new_ver, self.maintainer in pkgs_to_upgrade: + error = None self.recipe = None attempted_pkgs += 1 I(" ATTEMPT PACKAGE %d/%d" % (attempted_pkgs, total_pkgs))@@ -489,10 +491,6 @@ class Updater(object): step() I(" %s: Upgrade SUCCESSFUL! Please test!" % self.pn) - error = None - except UpgradeNotNeededError as e: - I(" %s: %s" % (self.pn, e.message)) - error = e except Error as e: E(" %s: %s" % (self.pn, e.message)) E(" %s: Upgrade FAILED! Logs and/or file diffs areavailable in %s" % (self.pn, self.workdir)) @@ -667,7 +665,7 @@ class UniverseUpdater(Updater):
# overriding the base method def pkg_upgrade_handler(self, err):
upgradehelper.py class UniverseUpdater(Updater): · line 670
Quoted 4 lines
upgradehelper.py +1
-1- super(UniverseUpdater, self).pkg_upgrade_handler(self) + super(UniverseUpdater, self).pkg_upgrade_handler(err) self.update_history(self.pn, self.new_ver, self.maintainer, self._get_status_msg(err))
OK, after this v3, this and all other patches in this series look OK.
Cheers,
Paul
Signature · 2 lines
Paul Eggleton Intel Open Source Technology Centre