[OE-core] [Proof of concept] patch.bbclass: add incredibly naive 'git am' mode

Koen Kooi koen at dominion.thruhere.net
Wed Nov 30 15:43:04 UTC 2011


Signed-off-by: Koen Kooi <koen at dominion.thruhere.net>
---
 meta/classes/patch.bbclass |    1 +
 meta/lib/oe/patch.py       |   14 ++++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
index ac6c1ce..9f99e38 100644
--- a/meta/classes/patch.bbclass
+++ b/meta/classes/patch.bbclass
@@ -18,6 +18,7 @@ python patch_do_patch() {
 		"patch": oe.patch.PatchTree,
 		"quilt": oe.patch.QuiltTree,
 		"git": oe.patch.GitApplyTree,
+		"gitam": oe.patch.GitAmTree,
 	}
 
 	cls = patchsetmap[d.getVar('PATCHTOOL', 1) or 'quilt']
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
index f4ccb3e..06965ba 100644
--- a/meta/lib/oe/patch.py
+++ b/meta/lib/oe/patch.py
@@ -176,6 +176,20 @@ class GitApplyTree(PatchTree):
 
         return runcmd(["sh", "-c", " ".join(shellcmd)], self.dir)
 
+class GitAmTree(PatchTree):
+    def __init__(self, dir, d):
+        PatchTree.__init__(self, dir, d)
+
+    def _applypatch(self, patch, force = False, reverse = False, run = True):
+        shellcmd = ["git", "am"]
+
+        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):
-- 
1.7.2.5





More information about the Openembedded-core mailing list