From ebfa1700f41b3411aec040144605166c35b8dd14 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 7 Feb 2022 13:16:39 +0000 Subject: bitbake: fetch2/cooker: Fix source revision handling with floating upstreams Where a git url uses a tag instead of a full source revision, breakage can currently occur in builds. Issues include: * the revision being looked up in multiple tasks (fetch and unpack) * the risk a different revision may be obtained in those tasks * that some tasks may not be allowed to access the network * that a revision may not be consistent throughout a given build * rerunning a specific task may given inconsistent results To fix this, stop the workers from cleaning out the source revision store. This should only be done in the cooker itself (based on current policy). Also, where the code "sees" an upstream access, mark the recipe as not to be cached. The reparse re-triggers the upstream lookup by the server. Add a test to ensure that if get_srcrev isn't called, the user is told they're using a configuration that is known to break. (Bitbake rev: 4b5eed1626709ef3dc06b32fd55d40a2a6edd179) Signed-off-by: Richard Purdie --- bitbake/lib/bb/tests/fetch.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'bitbake/lib/bb/tests/fetch.py') diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index f368cd02b0..f0d417a50d 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py @@ -728,6 +728,7 @@ class FetcherLocalTest(FetcherTest): # Fetch and check revision self.d.setVar("SRCREV", "AUTOINC") + self.d.setVar("__BBSEENSRCREV", "1") url = "git://" + self.gitdir + ";branch=master;protocol=file;" + suffix fetcher = bb.fetch.Fetch([url], self.d) fetcher.download() @@ -1581,6 +1582,7 @@ class GitShallowTest(FetcherTest): self.d.setVar('BB_GIT_SHALLOW', '1') self.d.setVar('BB_GENERATE_MIRROR_TARBALLS', '0') self.d.setVar('BB_GENERATE_SHALLOW_TARBALLS', '1') + self.d.setVar("__BBSEENSRCREV", "1") def assertRefs(self, expected_refs, cwd=None): if cwd is None: @@ -2138,6 +2140,7 @@ class GitLfsTest(FetcherTest): self.d.setVar('SRCREV', '${AUTOREV}') self.d.setVar('AUTOREV', '${@bb.fetch2.get_autorev(d)}') + self.d.setVar("__BBSEENSRCREV", "1") bb.utils.mkdirhier(self.srcdir) self.git_init(cwd=self.srcdir) @@ -2746,6 +2749,7 @@ class GitSharedTest(FetcherTest): super(GitSharedTest, self).setUp() self.recipe_url = "git://git.openembedded.org/bitbake;branch=master" self.d.setVar('SRCREV', '82ea737a0b42a8b53e11c9cde141e9e9c0bd8c40') + self.d.setVar("__BBSEENSRCREV", "1") @skipIfNoNetwork() def test_shared_unpack(self): -- cgit v1.2.3-54-g00ecf