aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Elisei <alexandru.elisei@gmail.com>2017-01-18 19:15:54 +0200
committerBrian Dolbec <dolsen@gentoo.org>2017-01-19 12:35:20 -0800
commitf143e58dd3fd80ab67121e7a62e8cf47151d3907 (patch)
tree7a5981fef970b81b81ed1722e7be94f47db0c425 /pym/portage/emaint/modules/binhost/binhost.py
parentdepgraph: fix 'SonameAtom' object is not subscriptable (bug 606464) (diff)
downloadportage-f143e58dd3fd80ab67121e7a62e8cf47151d3907.tar.gz
portage-f143e58dd3fd80ab67121e7a62e8cf47151d3907.tar.bz2
portage-f143e58dd3fd80ab67121e7a62e8cf47151d3907.zip
emaint: exit with non-zero status code when module fails (bug 567478)
Module functions currently return a message to emaint after invocation. Emaint prints this message then exits normally (with a success return code) even if the module encountered an error. This patch aims to change this by having each module public function return a tuple of (returncode, message), where returncode is boolean True if the function was successful or False otherwise. Emaint will inspect the return codes and exit unsuccessfully if necessary. The variable PORT_LOGDIR was added to the test environment to prevent CleanLogs.clean() from failing when the variable isn't set or not a directory.
Diffstat (limited to 'pym/portage/emaint/modules/binhost/binhost.py')
-rw-r--r--pym/portage/emaint/modules/binhost/binhost.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/pym/portage/emaint/modules/binhost/binhost.py b/pym/portage/emaint/modules/binhost/binhost.py
index cf1213e94..527b02fb3 100644
--- a/pym/portage/emaint/modules/binhost/binhost.py
+++ b/pym/portage/emaint/modules/binhost/binhost.py
@@ -86,7 +86,9 @@ class BinhostHandler(object):
stale = set(metadata).difference(cpv_all)
for cpv in stale:
errors.append("'%s' is not in the repository" % cpv)
- return errors
+ if errors:
+ return (False, errors)
+ return (True, None)
def fix(self, **kwargs):
onProgress = kwargs.get('onProgress', None)
@@ -177,4 +179,4 @@ class BinhostHandler(object):
if maxval == 0:
maxval = 1
onProgress(maxval, maxval)
- return None
+ return (True, None)