Commit Graph

23 Commits

Author SHA1 Message Date
Christopher Larson 1670051a79 codeparser: silence non-literal warnings for vardeps
If the vardeps flag is not None, we now silence the warnings about
non-literal usage for that variable.

(Bitbake rev: e724b9f417d1baf898f5afc6376c73c1a2ad8db9)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-30 16:16:13 +00:00
Christopher Larson c61f04c34e codeparser: drop expand tracking
There are two usual cases involving bb.data.expand:

- Calling it with a string literal -- "bb.data.expand('${FOO}/${BAZ}/bleh', d)".
- Calling it on getVar results (legacy) -- "bb.data.expand(bb.data.getVar('FOO', d), d)"

Nothing in any of the usual layers uses it in any other way, and I'm
having trouble coming up with any real use cases beyond this. The first
of the above cases is already tracked, via the expandWithRefs called
on the python code string. The second didn't emit a warning anyway,
since the getVar was already handled.

Given this, I see no reason for us to maintain explicit expansion
tracking. Further, we weren't using its results anyway (the var_expands
member).

(Bitbake rev: 405dfe69e6a608826e599ebf2f83ef8cf5083b96)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-30 16:16:13 +00:00
Christopher Larson 2b26745c70 codeparser: accept a name for better messages
- If a name is passed to the parser, prepend the messages with "while
  parsing <name>:". This gives a bit more context.
- Tweak the warning messages slightly (they had to be altered anyway to
  inject the variable being parsed).

Before:
  DEBUG: Warning: in call to 'bb.data.getVar': argument ''%s' % var' is \
         not a literal

After:
  DEBUG: while parsing emit_pkgdata, in call of bb.data.getVar, argument \
         ''%s' % var' is not a string literal

(Bitbake rev: 1060193ae4d54e667735dbff5d1d2be49a3f95c9)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-30 16:16:12 +00:00
Christopher Larson 28ca6cc34b codeparser: simplify how we compare the called node names
With the previous method, using the compare_name methods, we split the
requested match name by '.', reversed it, then compared them piecemeal
during the node traversal. The new method walks the nodes and hands back
the name of what's being called, and then we check that. This also
consolidates the two different implementations of traversal of the
attribute/name nodes (one in compare_name, one for the execs).

(Bitbake rev: 84e535b5165c7e936c5b1486bdf4626ed3649f5f)

Signed-off-by: Christopher Larson <kergoth@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-30 16:16:12 +00:00
Christopher Larson ada59bde67 codeparser: merge the nested python parsing classes
The split is even less necessary now that we use ast.walk rather than an
actual NodeVisitor subclass.

(Bitbake rev: d6c44fac184abae8395bfa7078f06675218aa534)

Signed-off-by: Christopher Larson <kergoth@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-30 16:16:12 +00:00
Christopher Larson 46ac868403 codeparser: make var_expands actually hold useful information
Previously, it was calling var_expands.update() rather than add(), with
a string argument, resulting in adding each character of that string to
the var_expands set, rather than the string itself.

(Bitbake rev: 8e4e75383e43d6da2c16ec5286186a0d0569b0f8)

Signed-off-by: Christopher Larson <kergoth@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-30 16:16:11 +00:00
Richard Purdie 039798a4d2 codeparser: When loading the cache, ignore ValueError
(Bitbake rev: 9bff182a4ba9571679985b45b309990a6eddad14)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-06-15 11:13:13 +01:00
Richard Purdie fd00566144 bitbake/codeparser: Improve cache handling
The current codeparser cache handling hurts performance badly even
over a couple of cores and certainly on many core systems, it can
spent huge amounts of time in the codeparser cache save functions.

This patch reworks the cache handling so that each parsing thread
saves out its own "differences" file compared to any existing core
cache and then the main bitbake thread picks these up and merges
things back together.

This was tested on systems with small and large numbers of cores
and was found to perform orders of magnitude better in all cases
despite the more complex code.

(Bitbake rev: 9f27563d66523f5af1028f173d53ee75e0877d46)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-05-27 17:55:51 +01:00
Otavio Salvador 32a4e74627 codeparser.py: fix syntax error in exception handling
Commit 036cf3cd11b3a6836b77f5ffa760ceee6b71b1ef missed the needed
brackets to handle more then a type of exception.

(Bitbake rev: abecbb4c0af83c6b4ee248b0f03b779f84b13390)

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-05-24 17:16:47 +01:00
Richard Purdie 477934e5be codeparser.py: Ignore incomplete cache files
(Bitbake rev: 036cf3cd11b3a6836b77f5ffa760ceee6b71b1ef)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-05-12 23:39:20 +01:00
Richard Purdie 72875493b8 bitbake/codeparser: Correctly handle a missing/empty cache file
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-05-05 19:27:46 +01:00
Richard Purdie c8928e93dd bitbake/cooker/codeparser: Ensure the code parser cache is saved for each parsing process
Before this change, the codeparser cache was only being saved for the main
server process. This is suboptimal as it leaves code being re-evaluated at
task execution time and increases parse time.

We use the multiprocess Finalize() functionality to ensure each process
saves out its cache. We need to update the cache save function to be multiprocess
friendly with locking.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-05-05 15:52:53 +01:00
Chris Larson 626b96e255 codeparser: use ==, not 'is' to compare strings
(Bitbake rev: 8f5cf3a9975d8e6878e403be0e6edc22cc44f396)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-03-31 12:23:19 +01:00
Joshua Lock 92d5e6c07f bitbake/codeparser: fix raising of ShellSyntaxError
To raise the ShellSyntaxError we need to import it's module and reference it
by namespace.

Signed-off-by: Joshua Lock <josh@linux.intel.com>
2011-02-25 15:38:29 +00:00
Bernhard Reutner-Fischer c405a3a13e codeparser: fix spacing in diagnostic messages
(Bitbake rev: 8c5555f5ed6d61db57de80d2820c8cec64a27239)

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-01-12 13:47:08 +00:00
Richard Purdie c036d1a5a0 bitbake/codeparser: Fix import to match upstream bitbake
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-01-10 13:24:05 +00:00
Richard Purdie 0090a798eb bitbake: Sync a load of whitespace and other non-functionality changes with bitbake uptream
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2011-01-04 14:46:54 +00:00
Chris Larson 4addbd191d Move the pysh package into the bb package
The pysh we're using is modified, and we don't want to risk it conflicting
with one from elsewhere.

(Bitbake rev: 1cbf8a9403b4b60d59bfd90a51c3e4246ab834d6)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2011-01-04 14:46:39 +00:00
Richard Purdie d85dc37b73 codeparser.py: Fix storing of hash values as object references can be corrupted
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-09-28 12:05:15 +01:00
Richard Purdie 647713050b bitbake/codeparser: Deal with functions with trailing whitespace
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-09-07 14:33:53 +01:00
Richard Purdie 453d8f49ac bitbake/codeparser: Ensure cached sheel entries return the correct dependencies
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-09-03 16:08:32 +01:00
Richard Purdie 9897b81e56 bitbake/codeparser: Implement persistent cache
For a given input to this code, the output doesn't change to implement a persistent
cache of the data to speed up parsing.

Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-08-31 14:49:14 +01:00
Richard Purdie 3492bff64a bitbake: Add codeparser for parsing shell and python functions
This commit is derived from Chris Larson's checksum work, turned into a
standalone piece of code for parsing python and shell functions.

The deindent code has been replaced with code to work around indentation
for speed. The original NodeVisitor in the ast was replaced with a faster
class walk call.

Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-08-31 12:41:23 +01:00