1
0
mirror of https://git.yoctoproject.org/poky synced 2026-07-17 04:07:06 +00:00

patch.py: Prevent git repo reinitialization

There were few bugs in the _isInitialized() function which might trigger
git repo to be reinitialized and patches failing to apply.

(From OE-Core rev: 427f4ef11beb8ceee007b5c7e152f2383a114aca)

Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Pavel Zhukov
2022-03-07 11:19:29 +01:00
committed by Richard Purdie
parent 2c9e93bc40
commit 630d754ea3
4 changed files with 49 additions and 5 deletions
+8 -3
View File
@@ -304,14 +304,19 @@ class GitApplyTree(PatchTree):
def _isInitialized(self):
cmd = "git rev-parse --show-toplevel"
(status, output) = subprocess.getstatusoutput(cmd.split())
try:
output = runcmd(cmd.split(), self.dir).strip()
except CmdError as err:
## runcmd returned non-zero which most likely means 128
## Not a git directory
return False
## Make sure repo is in builddir to not break top-level git repos
return status == 0 and os.path.samedir(output, self.dir)
return os.path.samefile(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)
runcmd("git commit -a --allow-empty -m bitbake_patching_started".split(), self.dir)
@staticmethod
def extractPatchHeader(patchfile):