]> code.ossystems Code Review - openembedded-core.git/commitdiff
patch.bbclass: Merge in git resolver changes from OE.dev. Catch all exceptions rather...
authorRichard Purdie <rpurdie@linux.intel.com>
Thu, 3 Sep 2009 21:22:10 +0000 (22:22 +0100)
committerRichard Purdie <rpurdie@linux.intel.com>
Thu, 3 Sep 2009 21:22:10 +0000 (22:22 +0100)
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
meta/classes/patch.bbclass

index 609e1a141580ab81caa1575d72d865669d3ada5f..ba0f19215d0e663a7c9aab2947812b653f13252a 100644 (file)
@@ -187,6 +187,24 @@ def patch_init(d):
                def Clean(self):
                        """"""
 
+       class GitApplyTree(PatchTree):
+               def __init__(self, dir, d):
+                       PatchTree.__init__(self, dir, d)
+
+               def _applypatch(self, patch, force = False, reverse = False, run = True):
+                       shellcmd = ["git", "--git-dir=.", "apply", "-p%s" % patch['strippath']]
+
+                       if reverse:
+                               shellcmd.append('-R')
+
+                       shellcmd.append(patch['file'])
+
+                       if not run:
+                               return "sh" + "-c" + " ".join(shellcmd)
+
+                       return runcmd(["sh", "-c", " ".join(shellcmd)], self.dir)
+
+
        class QuiltTree(PatchSet):
                def _runcmd(self, args, run = True):
                        quiltrc = bb.data.getVar('QUILTRCFILE', self.d, 1)
@@ -425,6 +443,7 @@ def patch_init(d):
        g["PatchSet"] = PatchSet
        g["PatchTree"] = PatchTree
        g["QuiltTree"] = QuiltTree
+       g["GitApplyTree"] = GitApplyTree
        g["Resolver"] = Resolver
        g["UserResolver"] = UserResolver
        g["NOOPResolver"] = NOOPResolver
@@ -451,6 +470,7 @@ python patch_do_patch() {
        patchsetmap = {
                "patch": PatchTree,
                "quilt": QuiltTree,
+               "git": GitApplyTree,
        }
 
        cls = patchsetmap[bb.data.getVar('PATCHTOOL', d, 1) or 'quilt']
@@ -544,12 +564,8 @@ python patch_do_patch() {
                bb.note("Applying patch '%s'" % pname)
                try:
                        patchset.Import({"file":unpacked, "remote":url, "strippath": pnum}, True)
-               except NotFoundError:
-                       import sys
-                       raise bb.build.FuncFailed(str(sys.exc_value))
-               try:
                        resolver.Resolve()
-               except PatchError:
+               except:
                        import sys
                        raise bb.build.FuncFailed(str(sys.exc_value))
 }