diff options
author | Pavel Zhukov <pavel@zhukoff.net> | 2022-02-21 20:17:29 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-02-25 12:41:23 +0000 |
commit | da344db43c856355412376e39b515998cc31afce (patch) | |
tree | 961a474124713b94ed85cd8487065344db7835ee /meta/lib/oe | |
parent | e43a9d15ea8ea04afe5a49a39cc3dd1f93783acd (diff) | |
download | poky-da344db43c856355412376e39b515998cc31afce.tar.gz |
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: 80500ecda4c1bc8812e6e078b6b0db5ec46624de)
Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r-- | meta/lib/oe/patch.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py index 950fe723dc..9034fcae03 100644 --- a/meta/lib/oe/patch.py +++ b/meta/lib/oe/patch.py | |||
@@ -304,14 +304,19 @@ class GitApplyTree(PatchTree): | |||
304 | 304 | ||
305 | def _isInitialized(self): | 305 | def _isInitialized(self): |
306 | cmd = "git rev-parse --show-toplevel" | 306 | cmd = "git rev-parse --show-toplevel" |
307 | (status, output) = subprocess.getstatusoutput(cmd.split()) | 307 | try: |
308 | output = runcmd(cmd.split(), self.dir).strip() | ||
309 | except CmdError as err: | ||
310 | ## runcmd returned non-zero which most likely means 128 | ||
311 | ## Not a git directory | ||
312 | return False | ||
308 | ## Make sure repo is in builddir to not break top-level git repos | 313 | ## Make sure repo is in builddir to not break top-level git repos |
309 | return status == 0 and os.path.samedir(output, self.dir) | 314 | return os.path.samefile(output, self.dir) |
310 | 315 | ||
311 | def _initRepo(self): | 316 | def _initRepo(self): |
312 | runcmd("git init".split(), self.dir) | 317 | runcmd("git init".split(), self.dir) |
313 | runcmd("git add .".split(), self.dir) | 318 | runcmd("git add .".split(), self.dir) |
314 | runcmd("git commit -a --allow-empty -m Patching_started".split(), self.dir) | 319 | runcmd("git commit -a --allow-empty -m bitbake_patching_started".split(), self.dir) |
315 | 320 | ||
316 | @staticmethod | 321 | @staticmethod |
317 | def extractPatchHeader(patchfile): | 322 | def extractPatchHeader(patchfile): |