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>
Sun, 20 Feb 2011 00:02:55 +0000 (16:02 -0800)
pym/_emerge/actions.py
pym/_emerge/main.py

index 75624300f87f2a5482e5d9dfe2e6f5ce26367cf5..e8a38ad1232f8fbd2231ecc1c55892e610a7ae70 100644 (file)
@@ -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()
index 0267f11e63063dc044a62f6e5da3889d6e752bad..f0f44b5a26e6bc4cfad7a6056534a71780055074 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):