Advertisement
Guest User

Untitled

a guest
Jul 11th, 2022
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.36 KB | None | 0 0
  1. diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
  2. index ac557176..156f37ef 100644
  3. --- a/lib/bb/fetch2/__init__.py
  4. +++ b/lib/bb/fetch2/__init__.py
  5. @@ -1221,22 +1221,22 @@ def get_checksum_file_list(d):
  6.      """
  7.      fetch = Fetch([], d, cache = False, localonly = True)
  8.  
  9. -    dl_dir = d.getVar('DL_DIR')
  10.      filelist = []
  11.      for u in fetch.urls:
  12.          ud = fetch.ud[u]
  13.  
  14.          if ud and isinstance(ud.method, local.Local):
  15. -            paths = ud.method.localpaths(ud, d)
  16. -            for f in paths:
  17. -                pth = ud.decodedurl
  18. -                if f.startswith(dl_dir):
  19. -                    # The local fetcher's behaviour is to return a path under DL_DIR if it couldn't find the file anywhere else
  20. -                    if os.path.exists(f):
  21. -                        bb.warn("Getting checksum for %s SRC_URI entry %s: file not found except in DL_DIR" % (d.getVar('PN'), os.path.basename(f)))
  22. -                    else:
  23. -                        bb.warn("Unable to get checksum for %s SRC_URI entry %s: file could not be found" % (d.getVar('PN'), os.path.basename(f)))
  24. -                filelist.append(f + ":" + str(os.path.exists(f)))
  25. +            path = ud.decodedurl
  26. +            candidate = ""
  27. +            if path[0] == "/":
  28. +                candidate = path
  29. +            else:
  30. +                filespath = d.getVar('FILESPATH')
  31. +                candidate = bb.utils.which(filespath, path)
  32. +            if candidate == "":
  33. +                bb.fatal("Unable to get checksum for %s SRC_URI entry %s: file could not be found" % (d.getVar('PN'), ud.decodedurl))
  34. +            # We already checked in the bb.utils.which that it exists
  35. +            filelist.append(candidate + ":True")
  36.  
  37.      return " ".join(filelist)
  38.  
  39. diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
  40. index ee41bff4..252f023f 100644
  41. --- a/lib/bb/tests/fetch.py
  42. +++ b/lib/bb/tests/fetch.py
  43. @@ -693,6 +693,11 @@ class FetcherLocalTest(FetcherTest):
  44.          flst.sort()
  45.          return flst
  46.  
  47. +    def test_local_checksum_fails_no_file(self):
  48. +        self.d.setVar("SRC_URI", "file://404")
  49. +        with self.assertRaises(bb.BBHandledException):
  50. +            bb.fetch.local.Local.get_checksum_file_list(self.d)
  51. +
  52.      def test_local(self):
  53.          tree = self.fetchUnpack(['file://a', 'file://dir/c'])
  54.          self.assertEqual(tree, ['a', 'dir/c'])
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement