From: Saul Wold <sgw@linux.intel.com>
To: Laszlo Papp <lpapp@kde.org>,
openembedded-core <openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH] lib/oe/patch.py: Prefer "git am" over "git apply" when applying git patches
Date: Mon, 06 Jan 2014 14:10:02 -0800 [thread overview]
Message-ID: <52CB29BA.5050404@linux.intel.com> (raw)
In-Reply-To: <CAOMwXhOfJEkntBTQLDGWjRYA6jorCWNEUF1+t8n5RJJoozcVJA@mail.gmail.com>
On 12/31/2013 06:18 AM, Laszlo Papp wrote:
> Ping?
>
> Alternatively, the system could also have an option for further
> fine-tuning what to do with git patches
>
> On Tue, Dec 24, 2013 at 12:44 PM, Laszlo Papp <lpapp@kde.org> wrote:
>> It is better to use "git am" when possible to preserve the commit messages and
>> the mail format in general for patches when those are present. A typical use
>> case is when developers would like to keep the changes on top of the latest
>> upstream, and they may occasionally need to rebase. This is not possible with
>> "git diff" and "diff" generated patches.
>>
>> Since this is not always the case, the fallback would be the "git apply"
>> operation which is currently available.
>>
Looking at this, is it possible to detect a git patch and only then use
git am? Since most of the patches carried in oe-core and other layers
the 'git am' will typically fail and increase the build time since it
will have to re-run the git apply, we don't want to had more forking and
work in the main hot path.
I am not the expert in this, neither is RP, so maybe Chris can comment
further.
Thanks
Sau!
>> Signed-off-by: Laszlo Papp <lpapp@kde.org>
>> ---
>> meta/lib/oe/patch.py | 20 +++++++++++++-------
>> 1 file changed, 13 insertions(+), 7 deletions(-)
>>
>> diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
>> index 59abd0a..b085c9d 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):
>> --
>> 1.8.5.1
>>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
next prev parent reply other threads:[~2014-01-06 22:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-24 12:44 [PATCH] lib/oe/patch.py: Prefer "git am" over "git apply" when applying git patches Laszlo Papp
2013-12-31 14:18 ` Laszlo Papp
2014-01-06 22:10 ` Saul Wold [this message]
2014-01-07 11:46 ` Otavio Salvador
2014-01-09 16:38 ` Laszlo Papp
2014-01-07 12:16 ` Koen Kooi
2014-01-09 16:53 ` Laszlo Papp
2014-01-16 13:39 ` Laszlo Papp
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52CB29BA.5050404@linux.intel.com \
--to=sgw@linux.intel.com \
--cc=lpapp@kde.org \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.