summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/local.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-03-08 11:23:34 -0800
committerSaul Wold <sgw@linux.intel.com>2011-03-08 17:16:53 -0800
commitf432f1b01069c2083d420a2accde169f2dafdfab (patch)
tree73c0b0b7089fcfc10dd2613c2d97129407c53837 /bitbake/lib/bb/fetch2/local.py
parentd7fcae0778dde5184459ef4ed55a725c7a4d4954 (diff)
downloadpoky-f432f1b01069c2083d420a2accde169f2dafdfab.tar.gz
bitbake/fetch2: Allow local file:// urls to be found on mirrorsbernard-5.0rc2
With the current implementation, file:// urls as used by sstate don't access the mirror code, breaking sstate mirror support. This change enables the usual mirror handling. To do this, we remove the localfile special case, using the basename paramemter instead. We also ensure the downloads directory is checked for files. The drawback of this change is that file urls containing "*" globing require special casing in the core. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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.