All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tests/fetch: Add test for broken mirror tarball
@ 2022-06-16 16:15 Pavel, Zhukov <pavel
  2022-06-20  9:40 ` [bitbake-devel] " Luca Ceresoli
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel, Zhukov <pavel @ 2022-06-16 16:15 UTC (permalink / raw)
  To: bitbake-devel; +Cc: pavel, Pavel Zhukov

With PREMIRROR set and BB_NETWORK = "1" bitbake should not try to
fetch into non-initialized git directory if tarball is broken (or not in
gzip format)

[Yocto 14822]

Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com>
---
 lib/bb/tests/fetch.py | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index 622c46a0..ee41bff4 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -2895,3 +2895,28 @@ class FetchPremirroronlyNetworkTest(FetcherTest):
         fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
         with self.assertRaises(bb.fetch2.NetworkAccess):
             fetcher.download()
+
+class FetchPremirroronlyBrokenTarball(FetcherTest):
+
+    def setUp(self):
+        super(FetchPremirroronlyBrokenTarball, self).setUp()
+        self.mirrordir = os.path.join(self.tempdir, "mirrors")
+        os.mkdir(self.mirrordir)
+        self.reponame = "bitbake"
+        self.gitdir = os.path.join(self.tempdir, "git", self.reponame)
+        self.recipe_url = "git://git.fake.repo/bitbake"
+        self.d.setVar("BB_FETCH_PREMIRRORONLY", "1")
+        self.d.setVar("BB_NO_NETWORK", "1")
+        self.d.setVar("PREMIRRORS", self.recipe_url + " " + "file://{}".format(self.mirrordir) + " \n")
+        self.mirrorname = "git2_git.fake.repo.bitbake.tar.gz"
+        with open(os.path.join(self.mirrordir, self.mirrorname), 'w') as targz:
+            targz.write("This is not tar.gz file!")
+
+    def test_mirror_broken_download(self):
+        import sys
+        self.d.setVar("SRCREV", "0"*40)
+        fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
+        with self.assertRaises(bb.fetch2.FetchError):
+            fetcher.download()
+        stdout = sys.stdout.getvalue()
+        self.assertFalse(" not a git repository (or any parent up to mount point /)" in stdout)
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [bitbake-devel] [PATCH] tests/fetch: Add test for broken mirror tarball
  2022-06-16 16:15 [PATCH] tests/fetch: Add test for broken mirror tarball Pavel, Zhukov <pavel
@ 2022-06-20  9:40 ` Luca Ceresoli
  0 siblings, 0 replies; 2+ messages in thread
From: Luca Ceresoli @ 2022-06-20  9:40 UTC (permalink / raw)
  To: Pavel Zhukov; +Cc: bitbake-devel, Pavel Zhukov

Hi Pavel,

On Thu, 16 Jun 2022 18:15:22 +0200
"Pavel Zhukov" <pavel@zhukoff.net> wrote:

> With PREMIRROR set and BB_NETWORK = "1" bitbake should not try to

s/PREMIRROR/PREMIRRORS/
s/BB_NETWORK/BB_NO_NETWORK/

I fixed those when applying your patch for testing, thus no need to
resend just for these.

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-20  9:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16 16:15 [PATCH] tests/fetch: Add test for broken mirror tarball Pavel, Zhukov <pavel
2022-06-20  9:40 ` [bitbake-devel] " Luca Ceresoli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.