1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-08 05:09:24 +00:00

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>
This commit is contained in:
Julian Haller
2025-04-04 14:10:45 +02:00
committed by Richard Purdie
parent f3948d6ee3
commit 1def15acc2
+4 -3
View File
@@ -3297,7 +3297,8 @@ class FetchPremirroronlyNetworkTest(FetcherTest):
import shutil
self.mirrorname = "git2_git.yoctoproject.org.fstests.tar.gz"
os.makedirs(self.clonedir)
self.git("clone --bare --shallow-since=\"01.01.2013\" {}".format(self.recipe_url), self.clonedir)
self.git("clone --bare {}".format(self.recipe_url), self.clonedir)
self.git("update-ref HEAD 15413486df1f5a5b5af699b6f3ba5f0984e52a9f", self.gitdir)
bb.process.run('tar -czvf {} .'.format(os.path.join(self.mirrordir, self.mirrorname)), cwd = self.gitdir)
shutil.rmtree(self.clonedir)
@@ -3305,7 +3306,7 @@ class FetchPremirroronlyNetworkTest(FetcherTest):
def test_mirror_tarball_updated(self):
self.make_git_repo()
## Upstream commit is in the mirror
self.d.setVar("SRCREV", "49d65d53c2bf558ae6e9185af0f3af7b79d255ec")
self.d.setVar("SRCREV", "15413486df1f5a5b5af699b6f3ba5f0984e52a9f")
fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
fetcher.download()
@@ -3313,7 +3314,7 @@ class FetchPremirroronlyNetworkTest(FetcherTest):
def test_mirror_tarball_outdated(self):
self.make_git_repo()
## Upstream commit not in the mirror
self.d.setVar("SRCREV", "15413486df1f5a5b5af699b6f3ba5f0984e52a9f")
self.d.setVar("SRCREV", "49d65d53c2bf558ae6e9185af0f3af7b79d255ec")
fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
with self.assertRaises(bb.fetch2.NetworkAccess):
fetcher.download()