Message ID | 20221229170728.880367-15-richard.purdie@linuxfoundation.org |
---|---|
State | Accepted, archived |
Commit | aeacfd391903fe68ae600470fc2bbad0502d401e |
Headers | show |
Series | Bitbake server thread enabling | expand |
> -----Original Message----- > From: bitbake-devel@lists.openembedded.org <bitbake-devel@lists.openembedded.org> On Behalf Of Richard Purdie > Sent: den 29 december 2022 18:07 > To: bitbake-devel@lists.openembedded.org > Subject: [bitbake-devel] [PATCH 14/15] cache: Drop reciever side counting for SiggenRecipeInfo Change "reciever" to "receiver". > > Joshua Watt pointed out maintaining the counting on both sides of the > connection isn't needed. Remove the receiver side counting and simplify > the code, also allowing errors if the counts do go out of sync. > > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> > --- > lib/bb/cache.py | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > > diff --git a/lib/bb/cache.py b/lib/bb/cache.py > index 3fc097241a..ee924b2d2b 100644 > --- a/lib/bb/cache.py > +++ b/lib/bb/cache.py > @@ -285,7 +285,6 @@ class SiggenRecipeInfo(RecipeInfoCommon): > cls.save_map = {} > cls.save_count = 1 > cls.restore_map = {} > - cls.restore_count = {} > > @classmethod > def _save(cls, deps): > @@ -294,11 +293,13 @@ class SiggenRecipeInfo(RecipeInfoCommon): > return deps > for dep in deps: > fs = deps[dep] > - if fs in cls.save_map: > + if fs is None: > + ret.append((dep, None, None)) > + elif fs in cls.save_map: > ret.append((dep, None, cls.save_map[fs])) > else: > cls.save_map[fs] = cls.save_count > - ret.append((dep, fs, None)) > + ret.append((dep, fs, cls.save_count)) > cls.save_count = cls.save_count + 1 > return ret > > @@ -309,18 +310,18 @@ class SiggenRecipeInfo(RecipeInfoCommon): > return deps > if pid not in cls.restore_map: > cls.restore_map[pid] = {} > - cls.restore_count[pid] = 1 > map = cls.restore_map[pid] > for dep, fs, mapnum in deps: > - if mapnum: > + if fs is None and mapnum is None: > + ret[dep] = None > + elif fs is None: > ret[dep] = map[mapnum] > else: > try: > fs = cls.store[fs] > except KeyError: > cls.store[fs] = fs > - map[cls.restore_count[pid]] = fs > - cls.restore_count[pid] = cls.restore_count[pid] + 1 > + map[mapnum] = fs > ret[dep] = fs > return ret > > -- > 2.37.2 //Peter
diff --git a/lib/bb/cache.py b/lib/bb/cache.py index 3fc097241a..ee924b2d2b 100644 --- a/lib/bb/cache.py +++ b/lib/bb/cache.py @@ -285,7 +285,6 @@ class SiggenRecipeInfo(RecipeInfoCommon): cls.save_map = {} cls.save_count = 1 cls.restore_map = {} - cls.restore_count = {} @classmethod def _save(cls, deps): @@ -294,11 +293,13 @@ class SiggenRecipeInfo(RecipeInfoCommon): return deps for dep in deps: fs = deps[dep] - if fs in cls.save_map: + if fs is None: + ret.append((dep, None, None)) + elif fs in cls.save_map: ret.append((dep, None, cls.save_map[fs])) else: cls.save_map[fs] = cls.save_count - ret.append((dep, fs, None)) + ret.append((dep, fs, cls.save_count)) cls.save_count = cls.save_count + 1 return ret @@ -309,18 +310,18 @@ class SiggenRecipeInfo(RecipeInfoCommon): return deps if pid not in cls.restore_map: cls.restore_map[pid] = {} - cls.restore_count[pid] = 1 map = cls.restore_map[pid] for dep, fs, mapnum in deps: - if mapnum: + if fs is None and mapnum is None: + ret[dep] = None + elif fs is None: ret[dep] = map[mapnum] else: try: fs = cls.store[fs] except KeyError: cls.store[fs] = fs - map[cls.restore_count[pid]] = fs - cls.restore_count[pid] = cls.restore_count[pid] + 1 + map[mapnum] = fs ret[dep] = fs return ret
Joshua Watt pointed out maintaining the counting on both sides of the connection isn't needed. Remove the receiver side counting and simplify the code, also allowing errors if the counts do go out of sync. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> --- lib/bb/cache.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)