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

Mario Domenech Goulart mario.goulart at gmail.com
Wed Nov 30 15:40:34 UTC 2011


Hi,

On Wed, 30 Nov 2011 16:43:04 +0100 Koen Kooi <koen at dominion.thruhere.net> wrote:

> 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)

That'd result in

    'sh-cgit am'

Maybe you mean something like

    " ".join(["sh", "-c"] + shellcmd)

?

> +
> +        return runcmd(["sh", "-c", " ".join(shellcmd)], self.dir)
> +
>  
>  class QuiltTree(PatchSet):
>      def _runcmd(self, args, run = True):

Best wishes.
Mario
-- 
http://parenteses.org/mario




More information about the Openembedded-core mailing list