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 <[email protected]>
> ---
> .../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.
> 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 ('и')
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 = 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)
> + 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 = get_bb_var("SRC_URI",test_recipe)
> + 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 (#162049):
https://lists.openembedded.org/g/openembedded-core/message/162049
Mute This Topic: https://lists.openembedded.org/mt/89293670/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-