From d1e1f74aa4bdc0f01e065bcdb99fe27cd8d92ada Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 18 Feb 2011 08:16:31 -0800 Subject: [PATCH] emerge: warn to stderr if post_* hooks fail --- pym/_emerge/actions.py | 4 +++- pym/_emerge/main.py | 11 ++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index 75624300f..e8a38ad12 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -2432,7 +2432,9 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): retval = portage.process.spawn( [postsync, dosyncuri], env=settings.environ()) if retval != os.EX_OK: - print(red(" * ") + bold("spawn failed of " + postsync)) + writemsg_level( + " %s spawn failed of %s\n" % (bad("*"), postsync,), + level=logging.ERROR, noiselevel=-1) if(mybestpv != mypvs) and not "--quiet" in myopts: print() diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index 0267f11e6..f0f44b5a2 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -367,14 +367,15 @@ def post_emerge(root_config, myopts, mtimedb, retval): if retval in (None, os.EX_OK) or (not "--pretend" in myopts): display_preserved_libs(vardbapi, myopts) - from portage.output import red, bold postemerge = os.path.join(settings["PORTAGE_CONFIGROOT"], - portage.USER_CONFIG_PATH, "bin", "post_emerge") + portage.USER_CONFIG_PATH, "bin", "post_emerge") if os.access(postemerge, os.X_OK): - retval = portage.process.spawn( + hook_retval = portage.process.spawn( [postemerge], env=settings.environ()) - if retval != os.EX_OK: - print(red(" * ") + bold("spawn failed of " + postemerge)) + if hook_retval != os.EX_OK: + writemsg_level( + " %s spawn failed of %s\n" % (bad("*"), postemerge,), + level=logging.ERROR, noiselevel=-1) sys.exit(retval) def multiple_actions(action1, action2): -- 2.26.2