summaryrefslogtreecommitdiff
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/patch.bbclass26
1 files changed, 21 insertions, 5 deletions
diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
index 609e1a1415..ba0f19215d 100644
--- a/meta/classes/patch.bbclass
+++ b/meta/classes/patch.bbclass
@@ -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))
}