summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/local.py54
1 files changed, 33 insertions, 21 deletions
diff --git a/bitbake/lib/bb/fetch2/local.py b/bitbake/lib/bb/fetch2/local.py
index 6fa188fc48..0785236a6b 100644
--- a/bitbake/lib/bb/fetch2/local.py
+++ b/bitbake/lib/bb/fetch2/local.py
@@ -51,29 +51,41 @@ class Local(FetchMethod):
51 """ 51 """
52 Return the local filename of a given url assuming a successful fetch. 52 Return the local filename of a given url assuming a successful fetch.
53 """ 53 """
54 return self.localpaths(urldata, d)[-1]
55
56 def localpaths(self, urldata, d):
57 """
58 Return the local filename of a given url assuming a successful fetch.
59 """
60 searched = []
54 path = urldata.decodedurl 61 path = urldata.decodedurl
55 newpath = path 62 newpath = path
56 if path[0] != "/": 63 if path[0] == "/":
57 filespath = data.getVar('FILESPATH', d, True) 64 return [path]
58 if filespath: 65 filespath = data.getVar('FILESPATH', d, True)
59 logger.debug(2, "Searching for %s in paths:\n %s" % (path, "\n ".join(filespath.split(":")))) 66 if filespath:
60 newpath = bb.utils.which(filespath, path) 67 logger.debug(2, "Searching for %s in paths:\n %s" % (path, "\n ".join(filespath.split(":"))))
61 if not newpath: 68 newpath, hist = bb.utils.which(filespath, path, history=True)
62 filesdir = data.getVar('FILESDIR', d, True) 69 searched.extend(hist)
63 if filesdir: 70 if not newpath:
64 logger.debug(2, "Searching for %s in path: %s" % (path, filesdir)) 71 filesdir = data.getVar('FILESDIR', d, True)
65 newpath = os.path.join(filesdir, path) 72 if filesdir:
66 if (not newpath or not os.path.exists(newpath)) and path.find("*") != -1: 73 logger.debug(2, "Searching for %s in path: %s" % (path, filesdir))
67 # For expressions using '*', best we can do is take the first directory in FILESPATH that exists 74 newpath = os.path.join(filesdir, path)
68 newpath = bb.utils.which(filespath, ".") 75 searched.append(newpath)
69 logger.debug(2, "Searching for %s in path: %s" % (path, newpath)) 76 if (not newpath or not os.path.exists(newpath)) and path.find("*") != -1:
70 return newpath 77 # For expressions using '*', best we can do is take the first directory in FILESPATH that exists
71 if not os.path.exists(newpath): 78 newpath, hist = bb.utils.which(filespath, ".", history=True)
72 dldirfile = os.path.join(d.getVar("DL_DIR", True), path) 79 searched.extend(hist)
73 logger.debug(2, "Defaulting to %s for %s" % (dldirfile, path)) 80 logger.debug(2, "Searching for %s in path: %s" % (path, newpath))
74 bb.utils.mkdirhier(os.path.dirname(dldirfile)) 81 return searched
75 return dldirfile 82 if not os.path.exists(newpath):
76 return newpath 83 dldirfile = os.path.join(d.getVar("DL_DIR", True), path)
84 logger.debug(2, "Defaulting to %s for %s" % (dldirfile, path))
85 bb.utils.mkdirhier(os.path.dirname(dldirfile))
86 searched.append(dldirfile)
87 return searched
88 return searched
77 89
78 def need_update(self, ud, d): 90 def need_update(self, ud, d):
79 if ud.url.find("*") != -1: 91 if ud.url.find("*") != -1: