emerge: warn to stderr if post_* hooks fail
authorZac Medico <zmedico@gentoo.org>
Fri, 18 Feb 2011 16:16:31 +0000 (08:16 -0800)
committerZac Medico <zmedico@gentoo.org>
Fri, 18 Feb 2011 16:16:31 +0000 (08:16 -0800)
pym/_emerge/actions.py
pym/_emerge/main.py

index 79d70baf0c3921dbeb085b79e573fdb164641ce2..5aa4f24ab2bcd1ffb5ef332246d8d9cee42573a1 100644 (file)
@@ -2453,7 +2453,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()
index 47975e340d51b568f12f1eebf889ec7021bdff53..0ddda852d1a9508377c9309a20961711f638fc96 100644 (file)
@@ -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):