All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] fetch2: local files only in DL_DIR becomes fatal error
@ 2022-07-08 20:54 Paulo Neves
  2022-07-08 20:54 ` [PATCH 2/2] fetch: bb.fatal when trying to checksum non-existing files Paulo Neves
  2022-07-09  6:52 ` [bitbake-devel] [PATCH 1/2] fetch2: local files only in DL_DIR becomes fatal error Richard Purdie
  0 siblings, 2 replies; 17+ messages in thread
From: Paulo Neves @ 2022-07-08 20:54 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Paulo Neves

When trying to checksum local files, if a given file is not found
anywhere else than the DL_DIR then this means that the the build is
inconsistent, and unreproducible.

This also means that if the DL_DIR is removed or not available the
build does not know how to fetch the file and will fail. With this
commit we fail earlier and consistently on this condition.

Signed-off-by: Paulo Neves <ptsneves@gmail.com>
---
 lib/bb/fetch2/__init__.py | 4 +++-
 lib/bb/tests/fetch.py     | 7 +++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index ac557176..5f05278a 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -1233,7 +1233,9 @@ def get_checksum_file_list(d):
                 if f.startswith(dl_dir):
                     # The local fetcher's behaviour is to return a path under DL_DIR if it couldn't find the file anywhere else
                     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)))
+                        bb.fatal(("Getting checksum for %s SRC_URI entry %s: file not found except in DL_DIR."
+                            " This means there is no way to get the file except for an orphaned copy"
+                            " 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)))
                 filelist.append(f + ":" + str(os.path.exists(f)))
diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index ee41bff4..3ebd9fd7 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -693,6 +693,13 @@ class FetcherLocalTest(FetcherTest):
         flst.sort()
         return flst
 
+    def test_local_checksum_fails_if_only_in_dldir(self):
+        with open(os.path.join(self.dldir, "on_dl_dir"), "wb"):
+            pass
+        self.d.setVar("SRC_URI", "file://on_dl_dir")
+        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'])
-- 
2.25.1



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

end of thread, other threads:[~2022-07-27 19:16 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-08 20:54 [PATCH 1/2] fetch2: local files only in DL_DIR becomes fatal error Paulo Neves
2022-07-08 20:54 ` [PATCH 2/2] fetch: bb.fatal when trying to checksum non-existing files Paulo Neves
2022-07-13  9:48   ` [bitbake-devel] " Alexandre Belloni
2022-07-13 10:10     ` Paulo Neves
2022-07-13 12:28       ` Richard Purdie
2022-07-26  4:09   ` Patrick Williams
2022-07-26  5:35     ` [bitbake-devel] " Alexander Kanavin
2022-07-26 15:57       ` Patrick Williams
2022-07-27 12:00         ` Alexander Kanavin
2022-07-27 14:50         ` Quentin Schulz
2022-07-27 19:16           ` Patrick Williams
2022-07-26  6:39     ` Richard Purdie
2022-07-26  7:01       ` Paulo Neves
2022-07-26 16:01         ` Patrick Williams
2022-07-09  6:52 ` [bitbake-devel] [PATCH 1/2] fetch2: local files only in DL_DIR becomes fatal error Richard Purdie
2022-07-09  7:19   ` Paulo Neves
     [not found]     ` <a7dffab1-9b0c-fab8-a538-81c3d0065834@gmail.com>
2022-07-09 13:20       ` Richard Purdie

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.