All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Lock <josh@linux.intel.com>
To: bitbake-devel@lists.openembedded.org
Subject: Re: [RFC PATCH 1/2] bitbake: track skipped packages
Date: Thu, 02 Jun 2011 13:01:52 -0700	[thread overview]
Message-ID: <1307044917.2050.15.camel@scimitar> (raw)
In-Reply-To: <1cd9d0b284c1cd1966b0c2c1ea9fbad15c5ed5fc.1306947210.git.paul.eggleton@linux.intel.com>

On Wed, 2011-06-01 at 18:26 +0100, Paul Eggleton wrote:
> Add skiplist to cooker that allows access to the list of packages skipped
> via SkipPackage (this includes COMPATIBLE_MACHINE, INCOMPATIBLE_LICENSE,
> etc.) This can be used to enhance error reporting.

Neat. Minor coding style nit below.

> 
> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
> ---
>  bitbake/lib/bb/cache.py     |   12 +++++++++---
>  bitbake/lib/bb/cooker.py    |   16 ++++++++++++++++
>  bitbake/lib/bb/parse/ast.py |   12 ++++++------
>  3 files changed, 31 insertions(+), 9 deletions(-)
> 
> diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
> index d083c51..076262b 100644
> --- a/bitbake/lib/bb/cache.py
> +++ b/bitbake/lib/bb/cache.py
> @@ -59,6 +59,7 @@ recipe_fields = (
>      'broken',
>      'not_world',
>      'skipped',
> +    'skipreason',
>      'timestamp',
>      'packages',
>      'packages_dynamic',
> @@ -128,11 +129,15 @@ class RecipeInfo(namedtuple('RecipeInfo', recipe_fields)):
>  
>      @classmethod
>      def from_metadata(cls, filename, metadata):
> -        if cls.getvar('__SKIPPED', metadata):
> +        skipval = cls.getvar('__SKIPPED', metadata)
> +        if skipval:
>              return cls.make_optional(skipped=True,
> +                                     skipreason=skipval,
>                                       file_depends=metadata.getVar('__depends', False),
>                                       timestamp=bb.parse.cached_mtime(filename),
> -                                     variants=cls.listvar('__VARIANTS', metadata) + [''])
> +                                     variants=cls.listvar('__VARIANTS', metadata) + [''],
> +                                     provides=cls.depvar('PROVIDES', metadata),
> +                                     rprovides=cls.depvar('RPROVIDES', metadata))
>  
>          tasks = metadata.getVar('__BBTASKS', False)
>  
> @@ -152,6 +157,7 @@ class RecipeInfo(namedtuple('RecipeInfo', recipe_fields)):
>              variants         = cls.listvar('__VARIANTS', metadata) + [''],
>  
>              skipped          = False,
> +            skipreason       = None,
>              timestamp        = bb.parse.cached_mtime(filename),
>              packages         = cls.listvar('PACKAGES', metadata),
>              pn               = pn,
> @@ -348,7 +354,7 @@ class Cache(object):
>          cached, infos = self.load(fn, appends, cfgData)
>          for virtualfn, info in infos:
>              if info.skipped:
> -                logger.debug(1, "Skipping %s", virtualfn)
> +                logger.debug(1, "Skipping %s: %s", (virtualfn, info.skipreason) )
>                  skipped += 1
>              else:
>                  self.add_info(virtualfn, info, cacheData, not cached)
> diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
> index 0b52f18..9b12e0d 100644
> --- a/bitbake/lib/bb/cooker.py
> +++ b/bitbake/lib/bb/cooker.py
> @@ -55,6 +55,20 @@ class NothingToBuild(Exception):
>  class state:
>      initial, parsing, running, shutdown, stop = range(5)
>  
> +
> +class SkippedPackage:
> +    def __init__(self, info = None, reason = None):
> +        self.skipreason = None
> +        self.provides = None
> +        self.rprovides = None
> +
> +        if info:
> +            self.skipreason = info.skipreason
> +            self.provides = info.provides
> +            self.rprovides = info.rprovides
> +        elif reason:
> +            self.skipreason = reason
> +
>  #============================================================================#
>  # BBCooker
>  #============================================================================#
> @@ -66,6 +80,7 @@ class BBCooker:
>      def __init__(self, configuration, server):
>          self.status = None
>          self.appendlist = {}
> +        self.skiplist = {}
>  
>          if server:
>              self.server = server.BitBakeServer(self)
> @@ -1198,6 +1213,7 @@ class CookerParser(object):
>          for virtualfn, info in result:
>              if info.skipped:
>                  self.skipped += 1
> +                self.cooker.skiplist[virtualfn] = SkippedPackage(info)
>              self.bb_cache.add_info(virtualfn, info, self.cooker.status,
>                                          parsed=parsed)
>          return True
> diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
> index 375dc61..18e491c 100644
> --- a/bitbake/lib/bb/parse/ast.py
> +++ b/bitbake/lib/bb/parse/ast.py
> @@ -376,8 +376,8 @@ def multi_finalize(fn, d):
>      try:
>          if not onlyfinalise or "default" in onlyfinalise:
>              finalize(fn, d)
> -    except bb.parse.SkipPackage:
> -        bb.data.setVar("__SKIPPED", True, d)
> +    except bb.parse.SkipPackage as e:
> +        bb.data.setVar("__SKIPPED", e.args[0], d)
>      datastores = {"": safe_d}
>  
>      versions = (d.getVar("BBVERSIONS", True) or "").split()
> @@ -419,8 +419,8 @@ def multi_finalize(fn, d):
>              verfunc(pv, d, safe_d)
>              try:
>                  finalize(fn, d)
> -            except bb.parse.SkipPackage:
> -                bb.data.setVar("__SKIPPED", True, d)
> +            except bb.parse.SkipPackage as e:
> +                bb.data.setVar("__SKIPPED", e.args[0], d)

This doesn't seem very Pythonic. I think you should just be able to do:
bb.data.setVar("__SKIPPED", e, d)
or possibly:
bb.data.setVar("__SKIPPED", str(e), d)

I know I'm being picky but that e.args[0] stuck out like a sore thumb.

>  
>          _create_variants(datastores, versions, verfunc)
>  
> @@ -439,8 +439,8 @@ def multi_finalize(fn, d):
>              try:
>                  if not onlyfinalise or variant in onlyfinalise:
>                      finalize(fn, variant_d, variant)
> -            except bb.parse.SkipPackage:
> -                bb.data.setVar("__SKIPPED", True, variant_d)
> +            except bb.parse.SkipPackage as e:
> +                bb.data.setVar("__SKIPPED", e.args[0], variant_d)

Same as above.

>  
>      if len(datastores) > 1:
>          variants = filter(None, datastores.iterkeys())

-- 
Joshua Lock
        Yocto Build System Monkey
        Intel Open Source Technology Centre




  reply	other threads:[~2011-06-02 20:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-01 17:26 [RFC PATCH 0/2] skipped recipe handling Paul Eggleton
2011-06-01 17:26 ` [RFC PATCH 1/2] bitbake: track skipped packages Paul Eggleton
2011-06-02 20:01   ` Joshua Lock [this message]
2011-06-03  9:51     ` Paul Eggleton
2011-06-03 16:38       ` Joshua Lock
2011-06-01 17:26 ` [RFC PATCH 2/2] bitbake-layers: handle skipped recipes Paul Eggleton
2011-06-02 20:03   ` Joshua Lock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1307044917.2050.15.camel@scimitar \
    --to=josh@linux.intel.com \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.