diff options
author | Joshua Lock <josh@linux.intel.com> | 2010-02-03 16:08:09 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-02-15 17:14:54 +0000 |
commit | 3a97876c379fd5f5f0822b75834349323e8ce09a (patch) | |
tree | 2f5a038c2369b8bd7704063654e1fbeba1998410 /lib/bb/fetch/__init__.py | |
parent | bfc1926034d3eb545c6683ea7ef2db79927a0838 (diff) | |
download | bitbake-3a97876c379fd5f5f0822b75834349323e8ce09a.tar.gz |
if PREMIRRORS set test for local file in FetchData.setup_localpath
When we are using PREMIRRORS it's possible a mirror in the local namespace
(some filesystem path, i.e. an NFS share) provides read-only files.
This is a perfectly valid scenario so this patch fixes bitbake so that for
such a scenario locapath is set to the files path rather than some child
of DL_DIR.
(From Poky rev: afe12428a9229b9a96f9e98c86d95786689aaf79)
Signed-off-by: Joshua Lock <josh@linux.intel.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'lib/bb/fetch/__init__.py')
-rw-r--r-- | lib/bb/fetch/__init__.py | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/lib/bb/fetch/__init__.py b/lib/bb/fetch/__init__.py index 5f4c8300e..6bce941fc 100644 --- a/lib/bb/fetch/__init__.py +++ b/lib/bb/fetch/__init__.py @@ -412,14 +412,28 @@ class FetchData(object): # if user sets localpath for file, use it instead. self.localpath = self.parm["localpath"] else: - try: - bb.fetch.srcrev_internal_call = True - self.localpath = self.method.localpath(self.url, self, d) - finally: - bb.fetch.srcrev_internal_call = False - # We have to clear data's internal caches since the cached value of SRCREV is now wrong. - # Horrible... - bb.data.delVar("ISHOULDNEVEREXIST", d) + premirrors = bb.data.getVar('PREMIRRORS', d) + local = "" + if premirrors and self.url: + aurl = self.url.split(";")[0] + mirrors = [ i.split() for i in (premirrors or "").split('\n') if i ] + for (find, replace) in mirrors: + if replace.startswith("file://"): + path = aurl.split("://")[1] + path = path.split(";")[0] + local = replace.split("://")[1] + os.path.basename(path) + if local == aurl or not os.path.exists(local) or os.path.isdir(local): + local = "" + self.localpath = local + if not local: + try: + bb.fetch.srcrev_internal_call = True + self.localpath = self.method.localpath(self.url, self, d) + finally: + bb.fetch.srcrev_internal_call = False + # We have to clear data's internal caches since the cached value of SRCREV is now wrong. + # Horrible... + bb.data.delVar("ISHOULDNEVEREXIST", d) # Note: These files should always be in DL_DIR whereas localpath may not be. basepath = bb.data.expand("${DL_DIR}/%s" % os.path.basename(self.localpath), d) |