summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/patch.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe/patch.py')
-rw-r--r--meta/lib/oe/patch.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
index 59abd0af19..b085c9d6b5 100644
--- a/meta/lib/oe/patch.py
+++ b/meta/lib/oe/patch.py
@@ -203,17 +203,23 @@ class GitApplyTree(PatchTree):
PatchTree.__init__(self, dir, d)
def _applypatch(self, patch, force = False, reverse = False, run = True):
- shellcmd = ["git", "--git-dir=.", "apply", "-p%s" % patch['strippath']]
+ def _applypatchhelper(shellcmd, patch, force = False, reverse = False, run = True):
+ if reverse:
+ shellcmd.append('-R')
- if reverse:
- shellcmd.append('-R')
+ shellcmd.append(patch['file'])
- shellcmd.append(patch['file'])
+ if not run:
+ return "sh" + "-c" + " ".join(shellcmd)
- if not run:
- return "sh" + "-c" + " ".join(shellcmd)
+ return runcmd(["sh", "-c", " ".join(shellcmd)], self.dir)
- return runcmd(["sh", "-c", " ".join(shellcmd)], self.dir)
+ try:
+ shellcmd = ["git", "--work-tree=.", "am", "-3", "-p%s" % patch['strippath']]
+ return _applypatchhelper(shellcmd, patch, force, reverse, run)
+ except CmdError:
+ shellcmd = ["git", "--git-dir=.", "apply", "-p%s" % patch['strippath']]
+ return _applypatchhelper(shellcmd, patch, force, reverse, run)
class QuiltTree(PatchSet):