From 9b398909bd446c32923e80125c4555463f87fa8e Mon Sep 17 00:00:00 2001 From: Paulo Neves Date: Fri, 8 Jul 2022 22:54:07 +0200 Subject: bitbake: fetch: bb.fatal when trying to checksum non-existing files If the local fetcher was not able to find the file anywhere but it was included in the SRC_URI for checksumming just make it a fatal error. Ensure a list of searched locations is included too to match the runtime error that would have resulted. (Bitbake rev: 5e3b2ad90d9cd0f248b1cb740637caa24442d101) Signed-off-by: Paulo Neves Signed-off-by: Richard Purdie --- bitbake/lib/bb/fetch2/__init__.py | 4 +++- bitbake/lib/bb/tests/fetch.py | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'bitbake') diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index ac557176d7..cd7dc4f132 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py @@ -1235,7 +1235,9 @@ def get_checksum_file_list(d): if os.path.exists(f): bb.warn("Getting checksum for %s SRC_URI entry %s: file not found except in DL_DIR" % (d.getVar('PN'), os.path.basename(f))) else: - bb.warn("Unable to get checksum for %s SRC_URI entry %s: file could not be found" % (d.getVar('PN'), os.path.basename(f))) + bb.fatal(("Unable to get checksum for %s SRC_URI entry %s: file could not be found" + "\nThe following paths were searched:" + "\n%s") % (d.getVar('PN'), os.path.basename(f), '\n'.join(paths))) filelist.append(f + ":" + str(os.path.exists(f))) return " ".join(filelist) diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index ee41bff43e..20d7953f35 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py @@ -693,6 +693,11 @@ class FetcherLocalTest(FetcherTest): flst.sort() return flst + def test_local_checksum_fails_no_file(self): + self.d.setVar("SRC_URI", "file://404") + with self.assertRaises(bb.BBHandledException): + bb.fetch.get_checksum_file_list(self.d) + def test_local(self): tree = self.fetchUnpack(['file://a', 'file://dir/c']) self.assertEqual(tree, ['a', 'dir/c']) -- cgit v1.2.3-54-g00ecf