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/oeqa/selftest/cases/bbtests.py | |
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/oeqa/selftest/cases/bbtests.py')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/bbtests.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/meta/lib/oeqa/selftest/cases/bbtests.py b/meta/lib/oeqa/selftest/cases/bbtests.py index ce72c4bcc6..35ad9f3cd6 100644 --- a/meta/lib/oeqa/selftest/cases/bbtests.py +++ b/meta/lib/oeqa/selftest/cases/bbtests.py | |||
@@ -307,11 +307,26 @@ INHERIT:remove = \"report-error\" | |||
307 | src = get_bb_var("SRC_URI",test_recipe) | 307 | src = get_bb_var("SRC_URI",test_recipe) |
308 | gitscm = re.search("git://", src) | 308 | gitscm = re.search("git://", src) |
309 | self.assertFalse(gitscm, "test_git_patchtool pre-condition failed: {} test recipe contains git repo!".format(test_recipe)) | 309 | self.assertFalse(gitscm, "test_git_patchtool pre-condition failed: {} test recipe contains git repo!".format(test_recipe)) |
310 | result = bitbake('man-db -c patch', ignore_status=False) | 310 | result = bitbake('{} -c patch'.format(test_recipe), ignore_status=False) |
311 | fatal = re.search("fatal: not a git repository (or any of the parent directories)", result.output) | 311 | fatal = re.search("fatal: not a git repository (or any of the parent directories)", result.output) |
312 | self.assertFalse(fatal, "Failed to patch using PATCHTOOL=\"git\"") | 312 | self.assertFalse(fatal, "Failed to patch using PATCHTOOL=\"git\"") |
313 | self.delete_recipeinc(test_recipe) | 313 | self.delete_recipeinc(test_recipe) |
314 | bitbake('-cclean man-db') | 314 | bitbake('-cclean {}'.format(test_recipe)) |
315 | |||
316 | def test_git_patchtool2(self): | ||
317 | """ Test if PATCHTOOL=git works with git repo and doesn't reinitialize it | ||
318 | """ | ||
319 | test_recipe = "gitrepotest" | ||
320 | src = get_bb_var("SRC_URI",test_recipe) | ||
321 | gitscm = re.search("git://", src) | ||
322 | self.assertTrue(gitscm, "test_git_patchtool pre-condition failed: {} test recipe doesn't contains git repo!".format(test_recipe)) | ||
323 | result = bitbake('{} -c patch'.format(test_recipe), ignore_status=False) | ||
324 | srcdir = get_bb_var('S', test_recipe) | ||
325 | result = runCmd("git log", cwd = srcdir) | ||
326 | self.assertFalse("bitbake_patching_started" in result.output, msg = "Repository has been reinitialized. {}".format(srcdir)) | ||
327 | self.delete_recipeinc(test_recipe) | ||
328 | bitbake('-cclean {}'.format(test_recipe)) | ||
329 | |||
315 | 330 | ||
316 | def test_git_unpack_nonetwork(self): | 331 | def test_git_unpack_nonetwork(self): |
317 | """ | 332 | """ |