diff options
author | Pavel Zhukov <pavel@zhukoff.net> | 2022-03-07 11:30:26 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-22 22:18:51 +0000 |
commit | 02a3d2d460c8172251c783d52b00ca256d23f351 (patch) | |
tree | c521a76e78a08206e677842299eb2344c5cb2ee4 /meta/lib/oeqa | |
parent | 677d20b0b8b530ab9196c685b46f32e3d6b3284b (diff) | |
download | poky-02a3d2d460c8172251c783d52b00ca256d23f351.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: 29d86bcad4fc43e09d7499c3f6fba8c499170b9b)
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>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/bbtests.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/meta/lib/oeqa/selftest/cases/bbtests.py b/meta/lib/oeqa/selftest/cases/bbtests.py index 0a618bb9a6..4187cb840a 100644 --- a/meta/lib/oeqa/selftest/cases/bbtests.py +++ b/meta/lib/oeqa/selftest/cases/bbtests.py | |||
@@ -310,8 +310,22 @@ INHERIT_remove = \"report-error\" | |||
310 | src = get_bb_var("SRC_URI",test_recipe) | 310 | src = get_bb_var("SRC_URI",test_recipe) |
311 | gitscm = re.search("git://", src) | 311 | gitscm = re.search("git://", src) |
312 | self.assertFalse(gitscm, "test_git_patchtool pre-condition failed: {} test recipe contains git repo!".format(test_recipe)) | 312 | self.assertFalse(gitscm, "test_git_patchtool pre-condition failed: {} test recipe contains git repo!".format(test_recipe)) |
313 | result = bitbake('man-db -c patch', ignore_status=False) | 313 | result = bitbake('{} -c patch'.format(test_recipe), ignore_status=False) |
314 | fatal = re.search("fatal: not a git repository (or any of the parent directories)", result.output) | 314 | fatal = re.search("fatal: not a git repository (or any of the parent directories)", result.output) |
315 | self.assertFalse(fatal, "Failed to patch using PATCHTOOL=\"git\"") | 315 | self.assertFalse(fatal, "Failed to patch using PATCHTOOL=\"git\"") |
316 | self.delete_recipeinc(test_recipe) | 316 | self.delete_recipeinc(test_recipe) |
317 | bitbake('-cclean man-db') | 317 | bitbake('-cclean {}'.format(test_recipe)) |
318 | |||
319 | def test_git_patchtool2(self): | ||
320 | """ Test if PATCHTOOL=git works with git repo and doesn't reinitialize it | ||
321 | """ | ||
322 | test_recipe = "gitrepotest" | ||
323 | src = get_bb_var("SRC_URI",test_recipe) | ||
324 | gitscm = re.search("git://", src) | ||
325 | self.assertTrue(gitscm, "test_git_patchtool pre-condition failed: {} test recipe doesn't contains git repo!".format(test_recipe)) | ||
326 | result = bitbake('{} -c patch'.format(test_recipe), ignore_status=False) | ||
327 | srcdir = get_bb_var('S', test_recipe) | ||
328 | result = runCmd("git log", cwd = srcdir) | ||
329 | self.assertFalse("bitbake_patching_started" in result.output, msg = "Repository has been reinitialized. {}".format(srcdir)) | ||
330 | self.delete_recipeinc(test_recipe) | ||
331 | bitbake('-cclean {}'.format(test_recipe)) | ||