[poky] [PATCH 8/8] Fetcher: only set __BB_DONT_CACHE when SRCREV = "${AUTOREV}"

Yu Ke ke.yu at intel.com
Mon Jan 10 17:28:18 PST 2011


On Jan 10, 20:37, Richard Purdie wrote:
> On Sun, 2011-01-09 at 19:50 +0800, Yu Ke wrote:
> > we should cache SRCREV whenever possible, the only exception is
> > when SREREV is auto rev. so change the logic to only set __BB_DONT_CACHE
> > at SRCREV = "${AUTOREV}" case
> > 
> > Signed-off-by: Yu Ke <ke.yu at intel.com>
> > ---
> >  bitbake/lib/bb/fetch2/__init__.py |    6 +++---
> >  1 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
> > index 44189ee..fd489a1 100644
> > --- a/bitbake/lib/bb/fetch2/__init__.py
> > +++ b/bitbake/lib/bb/fetch2/__init__.py
> > @@ -356,6 +356,9 @@ def localpaths(d):
> >      return local
> >  
> >  def get_autorev(d):
> > +    #  only not cache src rev in autorev case
> > +    if bb.data.getVar('BB_SRCREV_POLICY', d, True) != "cache":
> > +        bb.data.setVar('__BB_DONT_CACHE', '1', d)
> >      return "AUTOINC"
> >  
> >  def get_srcrev(d):
> > @@ -382,9 +385,6 @@ def get_srcrev(d):
> >          logger.error("SRCREV was used yet no valid SCM was found in SRC_URI")
> >          raise ParameterError
> >  
> > -    if bb.data.getVar('BB_SRCREV_POLICY', d, True) != "cache":
> > -        bb.data.setVar('__BB_DONT_CACHE', '1', d)
> > -
> >      if len(scms) == 1:
> >          return urldata[scms[0]].method.sortable_revision(scms[0], urldata[scms[0]], d)
> 
> I wasn't going to take this as I think its rather ugly. Looking at it
> further, its not really any less ugly than the existing code so I'm
> torn. I will take it as its an improvement and will make the user
> experience better but this approach relies on the cache to expand PV and
> call get_autorev() which is not obvious and the code should at least
> have a comment attached to it about how it works. Behaviour change in
> the cache could break this rather easily.

oh, yes. it is indeed not clean and fragile. I just blindly make the patch based on the orignal code and not think more.Idealy, if Cache.py has a hook that other component (e.g. fetcher) could register callback, and the callback will be executed in determed order, e.g. before Cache.add(), that will solve this problem. I will see if there is such place or any alternative.

Regards
Ke



> 
> Cheers,
> 
> Richard
> 
> _______________________________________________
> poky mailing list
> poky at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/poky



More information about the poky mailing list