Use _doebuild_exit_status_check() for unsuccessful return codes (no just
authorZac Medico <zmedico@gentoo.org>
Thu, 30 Apr 2009 07:03:30 +0000 (07:03 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 30 Apr 2009 07:03:30 +0000 (07:03 -0000)
successful ones), since we want to be sure to produce an informative warning
message whenever the shell exits unexpectedly (whether it's successful or
unsuccessful). This is important since it can be makes these kinds of issues
easier to diagnose (otherwise the user might blame portage, when it's really
the ebuild/eclasses that is at fault). (trunk r13311)

svn path=/main/branches/2.1.6/; revision=13482

pym/portage/__init__.py

index deb15022703ed76de399a8680d5785e293e3aaa2..7898733655df311294723d94f181621508230fe6 100644 (file)
@@ -4741,14 +4741,14 @@ def spawnebuild(mydo, actionmap, mysettings, debug, alwaysdep=0,
        if returnpid:
                return phase_retval
 
-       if phase_retval == os.EX_OK:
-               msg = _doebuild_exit_status_check(mydo, mysettings)
-               if msg:
+       msg = _doebuild_exit_status_check(mydo, mysettings)
+       if msg:
+               if phase_retval == os.EX_OK:
                        phase_retval = 1
-                       from textwrap import wrap
-                       from portage.elog.messages import eerror
-                       for l in wrap(msg, 72):
-                               eerror(l, phase=mydo, key=mysettings.mycpv)
+               from textwrap import wrap
+               from portage.elog.messages import eerror
+               for l in wrap(msg, 72):
+                       eerror(l, phase=mydo, key=mysettings.mycpv)
 
        _post_phase_userpriv_perms(mysettings)
        if mydo == "install":
@@ -5021,14 +5021,16 @@ def _spawn_misc_sh(mysettings, commands, **kwargs):
                        logfile=logfile, **kwargs)
        finally:
                pass
-       if rval == os.EX_OK:
-               msg = _doebuild_exit_status_check(mydo, mysettings)
-               if msg:
+
+       msg = _doebuild_exit_status_check(mydo, mysettings)
+       if msg:
+               if rval == os.EX_OK:
                        rval = 1
-                       from textwrap import wrap
-                       from portage.elog.messages import eerror
-                       for l in wrap(msg, 72):
-                               eerror(l, phase=mydo, key=mysettings.mycpv)
+               from textwrap import wrap
+               from portage.elog.messages import eerror
+               for l in wrap(msg, 72):
+                       eerror(l, phase=mydo, key=mysettings.mycpv)
+
        return rval
 
 _testing_eapis = frozenset()
@@ -5567,11 +5569,10 @@ def _doebuild_exit_status_check(mydo, settings):
        return msg
 
 def _doebuild_exit_status_check_and_log(settings, mydo, retval):
-       if retval != os.EX_OK:
-               return retval
        msg = _doebuild_exit_status_check(mydo, settings)
        if msg:
-               retval = 1
+               if retval == os.EX_OK:
+                       retval = 1
                from textwrap import wrap
                from portage.elog.messages import eerror
                for l in wrap(msg, 72):
@@ -5799,11 +5800,10 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
                        _doebuild_manifest_cache = mf
 
        def exit_status_check(retval):
-               if retval != os.EX_OK:
-                       return retval
                msg = _doebuild_exit_status_check(mydo, mysettings)
                if msg:
-                       retval = 1
+                       if retval == os.EX_OK:
+                               retval = 1
                        from textwrap import wrap
                        from portage.elog.messages import eerror
                        for l in wrap(msg, 72):