summaryrefslogtreecommitdiff
path: root/bitbake/lib
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2010-02-02 17:57:20 +0000
committerJoshua Lock <josh@linux.intel.com>2010-02-04 00:18:29 +0000
commitb571168ac7716a8ee4bee98ba5c3b53f70a13118 (patch)
tree4bbc3abca77be7db767888b04a3ff71c7cda2596 /bitbake/lib
parent095347fc691b68e7558470e1488157994aa6c7b8 (diff)
downloadopenembedded-core-b571168ac7716a8ee4bee98ba5c3b53f70a13118.tar.gz
openembedded-core-b571168ac7716a8ee4bee98ba5c3b53f70a13118.tar.bz2
openembedded-core-b571168ac7716a8ee4bee98ba5c3b53f70a13118.tar.xz
openembedded-core-b571168ac7716a8ee4bee98ba5c3b53f70a13118.zip
bitbake: Enhance the fetchers' support for local mirrors
Modify the try_mirrors() function to return the localpath of the fetched file and update the data dictionary to reflect this. Secondly the metadata files, lock and md5, should always be stored relative to the ${DL_DIR} as it is possible that the localpath is a read-only directory, for example in the scenario where there is a read-only file:// mirror. Signed-off-by: Joshua Lock <josh@linux.intel.com>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/fetch/__init__.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py
index ccb60de59..5f4c8300e 100644
--- a/bitbake/lib/bb/fetch/__init__.py
+++ b/bitbake/lib/bb/fetch/__init__.py
@@ -188,14 +188,19 @@ def go(d, urls = None):
# First try fetching uri, u, from PREMIRRORS
mirrors = [ i.split() for i in (bb.data.getVar('PREMIRRORS', d, 1) or "").split('\n') if i ]
- if not try_mirrors(d, u, mirrors):
+ localpath = try_mirrors(d, u, mirrors)
+ if not localpath:
# Next try fetching from the original uri, u
try:
m.go(u, ud, d)
+ localpath = ud.localpath
except:
# Finally, try fetching uri, u, from MIRRORS
mirrors = [ i.split() for i in (bb.data.getVar('MIRRORS', d, 1) or "").split('\n') if i ]
- try_mirrors (d, u, mirrors)
+ localpath = try_mirrors (d, u, mirrors)
+
+ if localpath:
+ ud.localpath = localpath
if ud.localfile:
if not m.forcefetch(u, ud, d):
@@ -355,7 +360,7 @@ def try_mirrors(d, uri, mirrors):
fpath = os.path.join(data.getVar("DL_DIR", d, 1), os.path.basename(uri))
if os.access(fpath, os.R_OK):
bb.msg.debug(1, bb.msg.domain.Fetcher, "%s already exists, skipping checkout." % fpath)
- return True
+ return fpath
ld = d.createCopy()
for (find, replace) in mirrors:
@@ -371,14 +376,14 @@ def try_mirrors(d, uri, mirrors):
try:
ud.method.go(newuri, ud, ld)
- return True
+ return ud.localpath
except (bb.fetch.MissingParameterError,
bb.fetch.FetchError,
bb.fetch.MD5SumError):
import sys
(type, value, traceback) = sys.exc_info()
bb.msg.debug(2, bb.msg.domain.Fetcher, "Mirror fetch failure: %s" % value)
- return False
+ return ""
class FetchData(object):
@@ -415,8 +420,11 @@ class FetchData(object):
# We have to clear data's internal caches since the cached value of SRCREV is now wrong.
# Horrible...
bb.data.delVar("ISHOULDNEVEREXIST", d)
- self.md5 = self.localpath + '.md5'
- self.lockfile = self.localpath + '.lock'
+
+ # 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)
+ self.md5 = basepath + '.md5'
+ self.lockfile = basepath + '.lock'
class Fetch(object):