diff options
Diffstat (limited to 'bitbake/lib/bb/fetch2/local.py')
| -rw-r--r-- | bitbake/lib/bb/fetch2/local.py | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/bitbake/lib/bb/fetch2/local.py b/bitbake/lib/bb/fetch2/local.py index bfef0791a5..3a34f2ad7f 100644 --- a/bitbake/lib/bb/fetch2/local.py +++ b/bitbake/lib/bb/fetch2/local.py | |||
| @@ -30,7 +30,8 @@ import urllib | |||
| 30 | import bb | 30 | import bb |
| 31 | import bb.utils | 31 | import bb.utils |
| 32 | from bb import data | 32 | from bb import data |
| 33 | from bb.fetch2 import FetchMethod | 33 | from bb.fetch2 import FetchMethod, FetchError |
| 34 | from bb.fetch2 import logger | ||
| 34 | 35 | ||
| 35 | class Local(FetchMethod): | 36 | class Local(FetchMethod): |
| 36 | def supports(self, url, urldata, d): | 37 | def supports(self, url, urldata, d): |
| @@ -41,16 +42,15 @@ class Local(FetchMethod): | |||
| 41 | 42 | ||
| 42 | def urldata_init(self, ud, d): | 43 | def urldata_init(self, ud, d): |
| 43 | # We don't set localfile as for this fetcher the file is already local! | 44 | # We don't set localfile as for this fetcher the file is already local! |
| 44 | ud.basename = os.path.basename(urllib.unquote(ud.url.split("://")[1].split(";")[0])) | 45 | ud.decodedurl = urllib.unquote(ud.url.split("://")[1].split(";")[0]) |
| 46 | ud.basename = os.path.basename(ud.decodedurl) | ||
| 45 | return | 47 | return |
| 46 | 48 | ||
| 47 | def localpath(self, url, urldata, d): | 49 | def localpath(self, url, urldata, d): |
| 48 | """ | 50 | """ |
| 49 | Return the local filename of a given url assuming a successful fetch. | 51 | Return the local filename of a given url assuming a successful fetch. |
| 50 | """ | 52 | """ |
| 51 | path = url.split("://")[1] | 53 | path = urldata.decodedurl |
| 52 | path = path.split(";")[0] | ||
| 53 | path = urllib.unquote(path) | ||
| 54 | newpath = path | 54 | newpath = path |
| 55 | if path[0] != "/": | 55 | if path[0] != "/": |
| 56 | filespath = data.getVar('FILESPATH', d, True) | 56 | filespath = data.getVar('FILESPATH', d, True) |
| @@ -76,7 +76,20 @@ class Local(FetchMethod): | |||
| 76 | def download(self, url, urldata, d): | 76 | def download(self, url, urldata, d): |
| 77 | """Fetch urls (no-op for Local method)""" | 77 | """Fetch urls (no-op for Local method)""" |
| 78 | # no need to fetch local files, we'll deal with them in place. | 78 | # no need to fetch local files, we'll deal with them in place. |
| 79 | return 1 | 79 | if self.supports_checksum(urldata) and not os.path.exists(urldata.localpath): |
| 80 | locations = [] | ||
| 81 | filespath = data.getVar('FILESPATH', d, True) | ||
| 82 | if filespath: | ||
| 83 | locations = filespath.split(":") | ||
| 84 | filesdir = data.getVar('FILESDIR', d, True) | ||
| 85 | if filesdir: | ||
| 86 | locations.append(filesdir) | ||
| 87 | locations.append(d.getVar("DL_DIR", True)) | ||
| 88 | |||
| 89 | msg = "Unable to find file " + url + " anywhere. The paths that were searched were:\n " + "\n ".join(locations) | ||
| 90 | raise FetchError(msg) | ||
| 91 | |||
| 92 | return True | ||
| 80 | 93 | ||
| 81 | def checkstatus(self, url, urldata, d): | 94 | def checkstatus(self, url, urldata, d): |
| 82 | """ | 95 | """ |
