diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-03-08 11:23:34 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-03-08 11:23:34 -0800 |
commit | a778fb311540580476976e43f9c0576284f8dc38 (patch) | |
tree | be189c6c765c6a5f81bd26e7ed66b30f19ff2587 /bitbake/lib/bb/fetch2/local.py | |
parent | fc1b893d1ae65f807c9c1100c2baefa10b52867a (diff) | |
download | poky-a778fb311540580476976e43f9c0576284f8dc38.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.
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.py | 13 |
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. |