summaryrefslogtreecommitdiffstats
path: root/lib/bb/fetch2/local.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-03-08 11:23:34 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-05-06 18:19:51 +0100
commit584df1efa04efbe51671e4911810dbdd0dee22d3 (patch)
tree21ea340a69830f02a7ec5cc0fc1fb7464f2ad017 /lib/bb/fetch2/local.py
parent12112102dd2808534505d4bfbb171904794428c2 (diff)
downloadbitbake-584df1efa04efbe51671e4911810dbdd0dee22d3.tar.gz
bitbake/fetch2: Allow local file:// urls to be found on mirrors
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. (From Poky rev: a778fb311540580476976e43f9c0576284f8dc38) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/fetch2/local.py')
-rw-r--r--lib/bb/fetch2/local.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/bb/fetch2/local.py b/lib/bb/fetch2/local.py
index 77a296ec6..ed9a047d8 100644
--- a/lib/bb/fetch2/local.py
+++ b/lib/bb/fetch2/local.py
@@ -40,6 +40,7 @@ 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(ud.url.split("://")[1].split(";")[0])
return
def localpath(self, url, urldata, d):
@@ -49,6 +50,9 @@ class Local(FetchMethod):
path = url.split("://")[1]
path = path.split(";")[0]
newpath = path
+ dldirfile = os.path.join(data.getVar("DL_DIR", d, True), os.path.basename(path))
+ if os.path.exists(dldirfile):
+ return dldirfile
if path[0] != "/":
filespath = data.getVar('FILESPATH', d, True)
if filespath:
@@ -57,8 +61,17 @@ class Local(FetchMethod):
filesdir = data.getVar('FILESDIR', d, True)
if filesdir:
newpath = os.path.join(filesdir, path)
+ if not os.path.exists(newpath) and path.find("*") == -1:
+ return dldirfile
return newpath
+ def need_update(self, url, ud, d):
+ if url.find("*") == -1:
+ return False
+ if os.path.exists(ud.localpath):
+ return False
+ return True
+
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.