diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-08-02 20:41:02 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-08-02 23:04:27 +0100 |
commit | 43a25fff557bf4a301f066672904eb0bf05f320f (patch) | |
tree | 2f63d2d5d370e2f7bf3a7ac8da283ba089d2697c /bitbake | |
parent | 67bfb37475d64a931c32b984de011480dcd7c79d (diff) | |
download | ast2050-yocto-poky-43a25fff557bf4a301f066672904eb0bf05f320f.zip ast2050-yocto-poky-43a25fff557bf4a301f066672904eb0bf05f320f.tar.gz |
bitbake: fetch2/local.py: Provide better debug output when fetch of a local file fails
When a fetch failure occurs for a local file, this patch ensures we print the
locations searched making it easier for the user to debug the problem.
(Bitbake rev: a461adbc5f09b41c771a7603370f6f2d1299ae8e)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-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 bfef079..3a34f2a 100644 --- a/bitbake/lib/bb/fetch2/local.py +++ b/bitbake/lib/bb/fetch2/local.py @@ -30,7 +30,8 @@ import urllib import bb import bb.utils from bb import data -from bb.fetch2 import FetchMethod +from bb.fetch2 import FetchMethod, FetchError +from bb.fetch2 import logger class Local(FetchMethod): def supports(self, url, urldata, d): @@ -41,16 +42,15 @@ class Local(FetchMethod): def urldata_init(self, ud, d): # We don't set localfile as for this fetcher the file is already local! - ud.basename = os.path.basename(urllib.unquote(ud.url.split("://")[1].split(";")[0])) + ud.decodedurl = urllib.unquote(ud.url.split("://")[1].split(";")[0]) + ud.basename = os.path.basename(ud.decodedurl) return def localpath(self, url, urldata, d): """ Return the local filename of a given url assuming a successful fetch. """ - path = url.split("://")[1] - path = path.split(";")[0] - path = urllib.unquote(path) + path = urldata.decodedurl newpath = path if path[0] != "/": filespath = data.getVar('FILESPATH', d, True) @@ -76,7 +76,20 @@ class Local(FetchMethod): def download(self, url, urldata, d): """Fetch urls (no-op for Local method)""" # no need to fetch local files, we'll deal with them in place. - return 1 + if self.supports_checksum(urldata) and not os.path.exists(urldata.localpath): + locations = [] + filespath = data.getVar('FILESPATH', d, True) + if filespath: + locations = filespath.split(":") + filesdir = data.getVar('FILESDIR', d, True) + if filesdir: + locations.append(filesdir) + locations.append(d.getVar("DL_DIR", True)) + + msg = "Unable to find file " + url + " anywhere. The paths that were searched were:\n " + "\n ".join(locations) + raise FetchError(msg) + + return True def checkstatus(self, url, urldata, d): """ |