From ae57c83f03247b5149c94ae8e8fc25d6ad27dc02 Mon Sep 17 00:00:00 2001 From: Pavel Zhukov Date: Thu, 2 Dec 2021 08:56:04 +0100 Subject: patch.py: Initialize git repo before patching If PATCHTOOL="git" has been specified but workdir is not git repo bitbake fails to apply the patches with error message: Command Error: 'git rev-parse --show-toplevel' exited with 0 Output: fatal: not a git repository (or any of the parent directories): .git Fix this by initializing the repo before patching. This allows binary git patches to be applied. (From OE-Core rev: 6184b56a7a0fc6f5d19fdfb81e7453667f7da940) Signed-off-by: Pavel Zhukov Signed-off-by: Richard Purdie --- meta/lib/oeqa/selftest/cases/bbtests.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'meta/lib/oeqa/selftest') diff --git a/meta/lib/oeqa/selftest/cases/bbtests.py b/meta/lib/oeqa/selftest/cases/bbtests.py index 6779e62103..a74576bc02 100644 --- a/meta/lib/oeqa/selftest/cases/bbtests.py +++ b/meta/lib/oeqa/selftest/cases/bbtests.py @@ -297,3 +297,18 @@ INHERIT:remove = \"report-error\" test_recipe_summary_after = get_bb_var('SUMMARY', test_recipe) self.assertEqual(expected_recipe_summary, test_recipe_summary_after) + + def test_git_patchtool(self): + """ PATCHTOOL=git should work with non-git sources like tarballs + test recipe for the test must NOT containt git:// repository in SRC_URI + """ + test_recipe = "man-db" + self.write_recipeinc(test_recipe, 'PATCHTOOL=\"git\"') + src = get_bb_var("SRC_URI",test_recipe) + gitscm = re.search("git://", src) + self.assertFalse(gitscm, "test_git_patchtool pre-condition failed: {} test recipe contains git repo!".format(test_recipe)) + result = bitbake('man-db -c patch', ignore_status=False) + fatal = re.search("fatal: not a git repository (or any of the parent directories)", result.output) + self.assertFalse(fatal, "Failed to patch using PATCHTOOL=\"git\"") + self.delete_recipeinc(test_recipe) + bitbake('-cclean man-db') -- cgit v1.2.3-54-g00ecf