All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fetch2: Fix urldata_cache key issues
@ 2020-03-27 14:48 Richard Purdie
  2020-03-29 12:21 ` [bitbake-devel] " Matt Madison
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Purdie @ 2020-03-27 14:48 UTC (permalink / raw)
  To: bitbake-devel

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 <richard.purdie@linuxfoundation.org>
---
 lib/bb/fetch2/__init__.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index d8ad19b59b..813f5eb773 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -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:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [bitbake-devel] [PATCH] fetch2: Fix urldata_cache key issues
  2020-03-27 14:48 [PATCH] fetch2: Fix urldata_cache key issues Richard Purdie
@ 2020-03-29 12:21 ` Matt Madison
  2020-03-29 21:43   ` Richard Purdie
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Madison @ 2020-03-29 12:21 UTC (permalink / raw)
  To: Richard Purdie; +Cc: bitbake-devel

On Fri, Mar 27, 2020 at 7:48 AM Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>
> 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 <richard.purdie@linuxfoundation.org>
> ---
>  lib/bb/fetch2/__init__.py | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
> index d8ad19b59b..813f5eb773 100644
> --- a/lib/bb/fetch2/__init__.py
> +++ b/lib/bb/fetch2/__init__.py
> @@ -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

> +        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
>
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bitbake-devel] [PATCH] fetch2: Fix urldata_cache key issues
  2020-03-29 12:21 ` [bitbake-devel] " Matt Madison
@ 2020-03-29 21:43   ` Richard Purdie
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2020-03-29 21:43 UTC (permalink / raw)
  To: Matt Madison; +Cc: bitbake-devel

On Sun, 2020-03-29 at 05:21 -0700, Matt Madison wrote:
> On Fri, Mar 27, 2020 at 7:48 AM Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
> > 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 <richard.purdie@linuxfoundation.org>
> > ---
> >  lib/bb/fetch2/__init__.py | 11 +++++++----
> >  1 file changed, 7 insertions(+), 4 deletions(-)
> > 
> > diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
> > index d8ad19b59b..813f5eb773 100644
> > --- a/lib/bb/fetch2/__init__.py
> > +++ b/lib/bb/fetch2/__init__.py
> > @@ -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?

No! Well spotted, thanks. I've fixed the patch.

Cheers,

Richard


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-29 21:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-27 14:48 [PATCH] fetch2: Fix urldata_cache key issues Richard Purdie
2020-03-29 12:21 ` [bitbake-devel] " Matt Madison
2020-03-29 21:43   ` Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.