Hi Konrad,

Test (very simple one) has been added (see v2). I'm not familiar with testsuite so please excuse me if I put it into wrong place. Also I'm not sure if it's ok to keep test more general (catch all errors like I did) or I have to check for specific error message.
 
-- 
Pavel
 
 
 
01.12.2021, 14:25, "Konrad Weihmann" <kweihm...@outlook.com>:

Could you please add a test case for that to the testing suite, as I'm
having issues to understand under what circumstances we are getting into
such kind of situation

On 01.12.21 14:19, Pavel Zhukov wrote:

 From: Pavel Zhukov <pavel.zhu...@huawei.com>
 
 If PATCHTOOL="git" has been specified but workdir is not git repo
 bitbake fails to apply the patches. Fix this by initializing the repo
 before patching.
 This allows binary git patches to be applied.
 
 Signed-off-by: Pavel Zhukov <pavel.zhu...@huawei.com>
 ---
   meta/lib/oe/patch.py | 17 +++++++++++++++++
   1 file changed, 17 insertions(+)
 
 diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
 index fccbedb519..8326cb55bc 100644
 --- a/meta/lib/oe/patch.py
 +++ b/meta/lib/oe/patch.py
 @@ -56,6 +56,10 @@ def runcmd(args, dir = None):
           if dir:
               os.chdir(olddir)
   
 +def getstatusoutput(cmd):
 + import subprocess
 + return subprocess.getstatusoutput(cmd.split())
 +
   class PatchError(Exception):
       def __init__(self, msg):
           self.msg = msg
 @@ -298,6 +302,19 @@ class GitApplyTree(PatchTree):
           PatchTree.__init__(self, dir, d)
           self.commituser = d.getVar('PATCH_GIT_USER_NAME')
           self.commitemail = d.getVar('PATCH_GIT_USER_EMAIL')
 + if not self._isInitialized():
 + self._initRepo()
 +
 + def _isInitialized(self):
 + cmd = "git rev-parse --show-toplevel"
 + (status, output) = getstatusoutput(cmd)
 + ## Make sure we're in builddir to not break top-level git repos
 + return status == 0 and os.path.samedir(output, self.dir)
 +
 + def _initRepo(self):
 + runcmd("git init".split(), self.dir)
 + runcmd("git add .".split(), self.dir)
 + runcmd("git commit -a --allow-empty -m Patching_started".split(), self.dir)
   
       @staticmethod
       def extractPatchHeader(patchfile):
 
 
 
 
 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#159032): 
https://lists.openembedded.org/g/openembedded-core/message/159032
Mute This Topic: https://lists.openembedded.org/mt/87426820/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to