summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-08-02 20:41:02 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-08-02 22:04:27 (GMT)
commit43a25fff557bf4a301f066672904eb0bf05f320f (patch)
tree2f63d2d5d370e2f7bf3a7ac8da283ba089d2697c /bitbake
parent67bfb37475d64a931c32b984de011480dcd7c79d (diff)
downloadpoky-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.py25
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
30import bb 30import bb
31import bb.utils 31import bb.utils
32from bb import data 32from bb import data
33from bb.fetch2 import FetchMethod 33from bb.fetch2 import FetchMethod, FetchError
34from bb.fetch2 import logger
34 35
35class Local(FetchMethod): 36class 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 """