summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/local.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/fetch2/local.py')
-rw-r--r--bitbake/lib/bb/fetch2/local.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/bitbake/lib/bb/fetch2/local.py b/bitbake/lib/bb/fetch2/local.py
index 77a296ec67..ed9a047d8d 100644
--- a/bitbake/lib/bb/fetch2/local.py
+++ b/bitbake/lib/bb/fetch2/local.py
@@ -40,6 +40,7 @@ class Local(FetchMethod):
40 40
41 def urldata_init(self, ud, d): 41 def urldata_init(self, ud, d):
42 # We don't set localfile as for this fetcher the file is already local! 42 # We don't set localfile as for this fetcher the file is already local!
43 ud.basename = os.path.basename(ud.url.split("://")[1].split(";")[0])
43 return 44 return
44 45
45 def localpath(self, url, urldata, d): 46 def localpath(self, url, urldata, d):
@@ -49,6 +50,9 @@ class Local(FetchMethod):
49 path = url.split("://")[1] 50 path = url.split("://")[1]
50 path = path.split(";")[0] 51 path = path.split(";")[0]
51 newpath = path 52 newpath = path
53 dldirfile = os.path.join(data.getVar("DL_DIR", d, True), os.path.basename(path))
54 if os.path.exists(dldirfile):
55 return dldirfile
52 if path[0] != "/": 56 if path[0] != "/":
53 filespath = data.getVar('FILESPATH', d, True) 57 filespath = data.getVar('FILESPATH', d, True)
54 if filespath: 58 if filespath:
@@ -57,8 +61,17 @@ class Local(FetchMethod):
57 filesdir = data.getVar('FILESDIR', d, True) 61 filesdir = data.getVar('FILESDIR', d, True)
58 if filesdir: 62 if filesdir:
59 newpath = os.path.join(filesdir, path) 63 newpath = os.path.join(filesdir, path)
64 if not os.path.exists(newpath) and path.find("*") == -1:
65 return dldirfile
60 return newpath 66 return newpath
61 67
68 def need_update(self, url, ud, d):
69 if url.find("*") == -1:
70 return False
71 if os.path.exists(ud.localpath):
72 return False
73 return True
74
62 def download(self, url, urldata, d): 75 def download(self, url, urldata, d):
63 """Fetch urls (no-op for Local method)""" 76 """Fetch urls (no-op for Local method)"""
64 # no need to fetch local files, we'll deal with them in place. 77 # no need to fetch local files, we'll deal with them in place.