--
21.02.2022, 15:15, "Christian Eggers" <cegg...@arri.de>:
On Monday, 21 February 2022, 14:57:46 CET, Pavel Zhukov wrote:
There were few bugs in the _isInitialized() function which might trigger
git repo to be reinitialized and patches failing to apply.
Signed-off-by: Pavel Zhukov <pavel.zhu...@huawei.com>
---
.../net-tools/Add_missing_headers.patch | 15 +++
.../net-tools/net-tools/net-tools-config.h | 75 +++++++++++
.../net-tools/net-tools/net-tools-config.make | 36 ++++++
.../recipes-test/net-tools/net-tools_2.10.bb | 121 ++++++++++++++++++I guess that these files have been added by accident.
They haven't. I've added test for PATCHTOOL="git" && git:// . I could use gitinpackoffline but it doesn't contain any patches. I was not able to reproduce the issue however.
meta/lib/oe/patch.py | 6 +-
meta/lib/oeqa/selftest/cases/bbtests.py | 20 ++-
6 files changed, 268 insertions(+), 5 deletions(-)
create mode 100644 meta-selftest/recipes-test/net-tools/net-tools/Add_missing_headers.patch
create mode 100644 meta-selftest/recipes-test/net-tools/net-tools/net-tools-config.h
create mode 100644 meta-selftest/recipes-test/net-tools/net-tools/net-tools-config.make
create mode 100644 meta-selftest/recipes-test/net-tools/net-tools_2.10.bb
...
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
index 950fe723dc..b6fe9b2bdd 100644
--- a/meta/lib/oe/patch.py
+++ b/meta/lib/oe/patch.py
@@ -304,14 +304,14 @@ class GitApplyTree(PatchTree):
def _isInitialized(self):
cmd = "git rev-parse --show-toplevel"
- (status, output) = subprocess.getstatusoutput(cmd.split())
+ (status, output) = subprocess.getstatusoutput(cmd)
## Make sure repo is in builddir to not break top-level git repos
- return status == 0 and os.path.samedir(output, self.dir)
+ return status == 0 and os.path.samefile(oиutput, self.dir)extra character ('и')
Oh. fat fingers. Thank you!
regards
Christian
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):
diff --git a/meta/lib/oeqa/selftest/cases/bbtests.py b/meta/lib/oeqa/selftest/cases/bbtests.py
index ce72c4bcc6..ae3f230038 100644
--- a/meta/lib/oeqa/selftest/cases/bbtests.py
+++ b/meta/lib/oeqa/selftest/cases/bbtests.py
@@ -307,11 +307,27 @@ INHERIT:remove = \"report-error\"
src = "" /> 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)
+ result = bitbake('{} -c patch'.format(test_recipe), 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')
+ bitbake('-cclean {}'.format(test_recipe))
+
+ def test_git_patchtool2(self):
+ """ Test if PATCHTOOL=git works with git repo and doesn't reinitialize it
+ """
+ test_recipe = "net-tools"
+ self.write_recipeinc(test_recipe, 'PATCHTOOL=\"git\"')
+ src = "" /> + gitscm = re.search("git://", src)
+ self.assertTrue(gitscm, "test_git_patchtool pre-condition failed: {} test recipe doesn't contains git repo!".format(test_recipe))
+ result = bitbake('{} -c patch'.format(test_recipe), ignore_status=False)
+ srcdir = get_bb_var('S', test_recipe)
+ result = runCmd("git log", cwd = srcdir)
+ self.assertFalse("bitbake_patching_started" in result.output, msg = "Repository has been reinitialized. {}".format(srcdir))
+ self.delete_recipeinc(test_recipe)
+ bitbake('-cclean {}'.format(test_recipe))
+
def test_git_unpack_nonetwork(self):
"""
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#162052): https://lists.openembedded.org/g/openembedded-core/message/162052 Mute This Topic: https://lists.openembedded.org/mt/89293670/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-