]> code.ossystems Code Review - openembedded-core.git/commitdiff
oe/patch: print cleaner error message when patch fails to apply
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Fri, 1 Apr 2016 15:02:42 +0000 (18:02 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 3 Apr 2016 14:51:08 +0000 (15:51 +0100)
[YOCTO #9344]

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oe/patch.py

index 6ab442778855f84500f3e8b30d20e95d417a167b..9d361729098e0582c2eed51b8002b3bdd04381c9 100644 (file)
@@ -214,13 +214,17 @@ class PatchTree(PatchSet):
         if not force:
             shellcmd.append('--dry-run')
 
-        output = runcmd(["sh", "-c", " ".join(shellcmd)], self.dir)
+        try:
+            output = runcmd(["sh", "-c", " ".join(shellcmd)], self.dir)
 
-        if force:
-            return
+            if force:
+                return
 
-        shellcmd.pop(len(shellcmd) - 1)
-        output = runcmd(["sh", "-c", " ".join(shellcmd)], self.dir)
+            shellcmd.pop(len(shellcmd) - 1)
+            output = runcmd(["sh", "-c", " ".join(shellcmd)], self.dir)
+        except CmdError as err:
+            raise bb.BBHandledException("Applying '%s' failed:\n%s" %
+                                        (os.path.basename(patch['file']), err.output))
 
         if not reverse:
             self._appendPatchFile(patch['file'], patch['strippath'])