fetch2: Fix urldata_cache key issues
PATCH 1/1 fetch2: Fix urldata_cache key issues
Upon inspection its clear the way the keys for this cache were being handled would break it and cause the cache to never be used. Fix this.
--- lib/bb/fetch2/__init__.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
lib/bb/fetch2/__init__.py +7 -4
@@ -1631,8 +1631,11 @@ class Fetch(object): fn = d.getVar('FILE') mc = d.getVar('__BBMULTICONFIG') or "" - if cache and fn and mc + fn in urldata_cache: - self.ud = urldata_cache[mc + fn + str(id(d))] + key = None + if cache and fn: + key = mc + fn in urldata_cache + if key in urldata_cache: + self.ud = urldata_cache[key] for url in urls: if url not in self.ud:
@@ -1643,8 +1646,8 @@ class Fetch(object): self.ud[url] = None pass - if fn and cache: - urldata_cache[mc + fn + str(id(d))] = self.ud + if key: + urldata_cache[key] = self.ud def localpath(self, url): if url not in self.urls:
Signature · 1 line
2.25.1
Quoted 14 lines · Richard Purdie
Upon inspection its clear the way the keys for this cache were being handled would break it and cause the cache to never be used. Fix this.
Signed-off-by Richard Purdie <[email protected]>--- lib/bb/fetch2/__init__.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)lib/bb/fetch2/__init__.py +0
-0
lib/bb/fetch2/__init__.py class Fetch(object): · line 1636
Quoted 8 lines
lib/bb/fetch2/__init__.py +3
-2@@ -1631,8 +1631,11 @@ class Fetch(object): fn = d.getVar('FILE') mc = d.getVar('__BBMULTICONFIG') or "" - if cache and fn and mc + fn in urldata_cache: - self.ud = urldata_cache[mc + fn + str(id(d))] + key = None + if cache and fn: + key = mc + fn in urldata_cache
This doesn't look right. Did you really mean to have the 'in urldata_cache' here?
-Matt
Quoted 20 lines
lib/bb/fetch2/__init__.py +4
-3+ if key in urldata_cache: + self.ud = urldata_cache[key] for url in urls: if url not in self.ud:@@ -1643,8 +1646,8 @@ class Fetch(object): self.ud[url] = None pass - if fn and cache: - urldata_cache[mc + fn + str(id(d))] = self.ud + if key: + urldata_cache[key] = self.ud def localpath(self, url): if url not in self.urls: --2.25.1
Quoted 17 lines · Matt Madison
Quoted 15 lines · Richard Purdie
Upon inspection its clear the way the keys for this cache were being handled
would break it and cause the cache to never be used. Fix this.Signed-off-by Richard Purdie <[email protected]>--- lib/bb/fetch2/__init__.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)lib/bb/fetch2/__init__.py +0
-0@@ -1631,8 +1631,11 @@ class Fetch(object):
Quoted 9 lines
lib/bb/fetch2/__init__.py class Fetch(object): · line 1636
Quoted 7 lines
lib/bb/fetch2/__init__.py +3
-2fn = d.getVar('FILE') mc = d.getVar('__BBMULTICONFIG') or "" - if cache and fn and mc + fn in urldata_cache: - self.ud = urldata_cache[mc + fn + str(id(d))] + key = None + if cache and fn: + key = mc + fn in urldata_cacheThis doesn't look right. Did you really mean to have the 'in
urldata_cache' here?
No! Well spotted, thanks. I've fixed the patch.
Cheers,
Richard