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

Richard Purdie richard.purdie at linuxfoundation.org
Mon Jan 10 12:37:18 PST 2011


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.

Cheers,

Richard




More information about the poky mailing list