summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorJulian Haller <julian.haller@philips.com>2025-04-04 14:10:45 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-04-10 11:07:38 +0100
commit1def15acc208040469e95349689ada0420326695 (patch)
tree6dbaec9cd944fe129ed4590ef7c211ea30709a7f /bitbake/lib
parentf3948d6ee319d9a20ff2ac2800ea957d43979996 (diff)
downloadpoky-1def15acc208040469e95349689ada0420326695.tar.gz
bitbake: bitbake: tests/fetch: Fix git PREMIRRORONLY test
Using a shallow clone to simulate an outdated git mirror tarball does not work in the intended way. A shallow clone already contains the latest commit which can hide certain fetcher behavior. Simulate an outdated mirror tarball, as the test titles indicate, by removing the newer commits from the mirror. (Bitbake rev: a51ee01f0a586fefd5a4061f4a1ca6cbf81b7046) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/tests/fetch.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index 4b5439f525..196d93c414 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -3297,7 +3297,8 @@ class FetchPremirroronlyNetworkTest(FetcherTest):
3297 import shutil 3297 import shutil
3298 self.mirrorname = "git2_git.yoctoproject.org.fstests.tar.gz" 3298 self.mirrorname = "git2_git.yoctoproject.org.fstests.tar.gz"
3299 os.makedirs(self.clonedir) 3299 os.makedirs(self.clonedir)
3300 self.git("clone --bare --shallow-since=\"01.01.2013\" {}".format(self.recipe_url), self.clonedir) 3300 self.git("clone --bare {}".format(self.recipe_url), self.clonedir)
3301 self.git("update-ref HEAD 15413486df1f5a5b5af699b6f3ba5f0984e52a9f", self.gitdir)
3301 bb.process.run('tar -czvf {} .'.format(os.path.join(self.mirrordir, self.mirrorname)), cwd = self.gitdir) 3302 bb.process.run('tar -czvf {} .'.format(os.path.join(self.mirrordir, self.mirrorname)), cwd = self.gitdir)
3302 shutil.rmtree(self.clonedir) 3303 shutil.rmtree(self.clonedir)
3303 3304
@@ -3305,7 +3306,7 @@ class FetchPremirroronlyNetworkTest(FetcherTest):
3305 def test_mirror_tarball_updated(self): 3306 def test_mirror_tarball_updated(self):
3306 self.make_git_repo() 3307 self.make_git_repo()
3307 ## Upstream commit is in the mirror 3308 ## Upstream commit is in the mirror
3308 self.d.setVar("SRCREV", "49d65d53c2bf558ae6e9185af0f3af7b79d255ec") 3309 self.d.setVar("SRCREV", "15413486df1f5a5b5af699b6f3ba5f0984e52a9f")
3309 fetcher = bb.fetch.Fetch([self.recipe_url], self.d) 3310 fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
3310 fetcher.download() 3311 fetcher.download()
3311 3312
@@ -3313,7 +3314,7 @@ class FetchPremirroronlyNetworkTest(FetcherTest):
3313 def test_mirror_tarball_outdated(self): 3314 def test_mirror_tarball_outdated(self):
3314 self.make_git_repo() 3315 self.make_git_repo()
3315 ## Upstream commit not in the mirror 3316 ## Upstream commit not in the mirror
3316 self.d.setVar("SRCREV", "15413486df1f5a5b5af699b6f3ba5f0984e52a9f") 3317 self.d.setVar("SRCREV", "49d65d53c2bf558ae6e9185af0f3af7b79d255ec")
3317 fetcher = bb.fetch.Fetch([self.recipe_url], self.d) 3318 fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
3318 with self.assertRaises(bb.fetch2.NetworkAccess): 3319 with self.assertRaises(bb.fetch2.NetworkAccess):
3319 fetcher.download() 3320 fetcher.download()