diff options
Diffstat (limited to 'bitbake/lib')
| -rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 16 | ||||
| -rw-r--r-- | bitbake/lib/bb/fetch2/local.py | 8 | ||||
| -rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 2 |
3 files changed, 8 insertions, 18 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index c1523fc1c1..0fb718b23e 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
| @@ -1222,25 +1222,21 @@ def get_checksum_file_list(d): | |||
| 1222 | SRC_URI as a space-separated string | 1222 | SRC_URI as a space-separated string |
| 1223 | """ | 1223 | """ |
| 1224 | fetch = Fetch([], d, cache = False, localonly = True) | 1224 | fetch = Fetch([], d, cache = False, localonly = True) |
| 1225 | |||
| 1226 | dl_dir = d.getVar('DL_DIR') | ||
| 1227 | filelist = [] | 1225 | filelist = [] |
| 1228 | for u in fetch.urls: | 1226 | for u in fetch.urls: |
| 1229 | ud = fetch.ud[u] | 1227 | ud = fetch.ud[u] |
| 1230 | |||
| 1231 | if ud and isinstance(ud.method, local.Local): | 1228 | if ud and isinstance(ud.method, local.Local): |
| 1229 | found = False | ||
| 1232 | paths = ud.method.localpaths(ud, d) | 1230 | paths = ud.method.localpaths(ud, d) |
| 1233 | for f in paths: | 1231 | for f in paths: |
| 1234 | pth = ud.decodedurl | 1232 | pth = ud.decodedurl |
| 1235 | if f.startswith(dl_dir): | 1233 | if os.path.exists(f): |
| 1236 | # The local fetcher's behaviour is to return a path under DL_DIR if it couldn't find the file anywhere else | 1234 | found = True |
| 1237 | if os.path.exists(f): | 1235 | filelist.append(f + ":" + str(os.path.exists(f))) |
| 1238 | bb.warn("Getting checksum for %s SRC_URI entry %s: file not found except in DL_DIR" % (d.getVar('PN'), os.path.basename(f))) | 1236 | if not found: |
| 1239 | else: | 1237 | bb.fatal(("Unable to get checksum for %s SRC_URI entry %s: file could not be found" |
| 1240 | bb.fatal(("Unable to get checksum for %s SRC_URI entry %s: file could not be found" | ||
| 1241 | "\nThe following paths were searched:" | 1238 | "\nThe following paths were searched:" |
| 1242 | "\n%s") % (d.getVar('PN'), os.path.basename(f), '\n'.join(paths))) | 1239 | "\n%s") % (d.getVar('PN'), os.path.basename(f), '\n'.join(paths))) |
| 1243 | filelist.append(f + ":" + str(os.path.exists(f))) | ||
| 1244 | 1240 | ||
| 1245 | return " ".join(filelist) | 1241 | return " ".join(filelist) |
| 1246 | 1242 | ||
diff --git a/bitbake/lib/bb/fetch2/local.py b/bitbake/lib/bb/fetch2/local.py index e7d1c8c58f..0bb987c644 100644 --- a/bitbake/lib/bb/fetch2/local.py +++ b/bitbake/lib/bb/fetch2/local.py | |||
| @@ -57,12 +57,6 @@ class Local(FetchMethod): | |||
| 57 | logger.debug2("Searching for %s in paths:\n %s" % (path, "\n ".join(filespath.split(":")))) | 57 | logger.debug2("Searching for %s in paths:\n %s" % (path, "\n ".join(filespath.split(":")))) |
| 58 | newpath, hist = bb.utils.which(filespath, path, history=True) | 58 | newpath, hist = bb.utils.which(filespath, path, history=True) |
| 59 | searched.extend(hist) | 59 | searched.extend(hist) |
| 60 | if not os.path.exists(newpath): | ||
| 61 | dldirfile = os.path.join(d.getVar("DL_DIR"), path) | ||
| 62 | logger.debug2("Defaulting to %s for %s" % (dldirfile, path)) | ||
| 63 | bb.utils.mkdirhier(os.path.dirname(dldirfile)) | ||
| 64 | searched.append(dldirfile) | ||
| 65 | return searched | ||
| 66 | return searched | 60 | return searched |
| 67 | 61 | ||
| 68 | def need_update(self, ud, d): | 62 | def need_update(self, ud, d): |
| @@ -78,8 +72,6 @@ class Local(FetchMethod): | |||
| 78 | filespath = d.getVar('FILESPATH') | 72 | filespath = d.getVar('FILESPATH') |
| 79 | if filespath: | 73 | if filespath: |
| 80 | locations = filespath.split(":") | 74 | locations = filespath.split(":") |
| 81 | locations.append(d.getVar("DL_DIR")) | ||
| 82 | |||
| 83 | msg = "Unable to find file " + urldata.url + " anywhere. The paths that were searched were:\n " + "\n ".join(locations) | 75 | msg = "Unable to find file " + urldata.url + " anywhere. The paths that were searched were:\n " + "\n ".join(locations) |
| 84 | raise FetchError(msg) | 76 | raise FetchError(msg) |
| 85 | 77 | ||
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 20d7953f35..7fcf57e7ea 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
| @@ -468,6 +468,7 @@ class MirrorUriTest(FetcherTest): | |||
| 468 | "http://.*/.* file:///someotherpath/downloads/" | 468 | "http://.*/.* file:///someotherpath/downloads/" |
| 469 | 469 | ||
| 470 | def test_urireplace(self): | 470 | def test_urireplace(self): |
| 471 | self.d.setVar("FILESPATH", ".") | ||
| 471 | for k, v in self.replaceuris.items(): | 472 | for k, v in self.replaceuris.items(): |
| 472 | ud = bb.fetch.FetchData(k[0], self.d) | 473 | ud = bb.fetch.FetchData(k[0], self.d) |
| 473 | ud.setup_localpath(self.d) | 474 | ud.setup_localpath(self.d) |
| @@ -925,6 +926,7 @@ class FetcherNetworkTest(FetcherTest): | |||
| 925 | 926 | ||
| 926 | @skipIfNoNetwork() | 927 | @skipIfNoNetwork() |
| 927 | def test_fetch_file_mirror_of_mirror(self): | 928 | def test_fetch_file_mirror_of_mirror(self): |
| 929 | self.d.setVar("FILESPATH", ".") | ||
| 928 | self.d.setVar("MIRRORS", "http://.*/.* file:///some1where/ file:///some1where/.* file://some2where/ file://some2where/.* https://downloads.yoctoproject.org/releases/bitbake") | 930 | self.d.setVar("MIRRORS", "http://.*/.* file:///some1where/ file:///some1where/.* file://some2where/ file://some2where/.* https://downloads.yoctoproject.org/releases/bitbake") |
| 929 | fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d) | 931 | fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d) |
| 930 | os.mkdir(self.dldir + "/some2where") | 932 | os.mkdir(self.dldir + "/some2where") |
