Commit Graph

51 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 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
Dongxiao Xu dfce2695b9 data_smart.py: make use of expand cache in getVar()
Currently if passing expand=True to getVar() function, it will pass the
handling to getVarFlag(), which doesn't get any benefit from the expand
cache.

Call the expand() function separately in getVar() to make use of the
expand cache, which can decrease the parsing time by 40%.
(from current 49s to 27s)

(Bitbake rev: 6555a77c199f41bf35460138764e03e30c56d29f)

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-08-29 14:13:34 +01:00
Richard Purdie 56e46f0bc4 bitbake/ast: Fix ??= vs. ?= handling
As the code stands, setting a variable with ??= could result in a ?=
variable not overriding it. This patch fixes the issue by allowing
the ast to make lookups that ignore any ??= set variables.

(Bitbake rev: 32fee2e650dfdd3aa9a7572dad1251e0c24ca34b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-07-05 11:39:05 +01:00
Richard Purdie 1b5d7b59d3 bitbake/data_smart: Don't track overrides in deleted variable names
When we delete a variable we no longer expect it to override other
variables.

To do this we remove it from the list of active overrides at deletion
time. It turns out we already had to do this at override expansion time
so this cleans up the code to be more consistent as an added bonus.

(Bitbake rev: d924ff9ede57c3dea6e1c738ba3633f18d460b14)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-06-28 15:27:41 +01:00
Richard Purdie 5c5b0045e8 bitbake/data_smart: Don't export deleted/empty entries in the list of keys
If you d.delVar(), you expect the variable to be gone. Even empty
variables continue to exist in the datastore and are still user visible
unfortunately. The COW siutation means you can't just remove it
since it might unmask a variable from an inner copy.

This patch therefore stops empty variables from appearing in key lists
exposed to the external world making empty variables an internal
implementation detail only.

(Bitbake rev: 2b5548c591d4cfde9238d2cc0959c42cfc08f09c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-06-28 15:27:41 +01:00
Richard Purdie cc2a8ff522 bitbake/data_smart: Optimise the data store iterator
Since we're going to creat the seen set() anyway, we might as well use
it directly. If we don't do this, we see thousands of function calls
with associated overhead on profiles.

(Bitbake rev: 9d43e3279895639ee4899df635f2546c7ee13737)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-06-28 15:27:40 +01:00
Richard Purdie eda23733f0 bitbake/data_smart: Change overrides behaviour to remove expanded variables from the datastore
Currently if you do:

OVERRIDES = "z"
DEPENDS_prepend = "a "
DEPENDS = "b"
DEPENDS_z = "c"

d.update_data()
d.getVar("DEPENDS")

gives "a c"

d.update_data()
d.getVar("DEPENDS")

then gives "c"

This patch changes the behaviour such that at the time bitbake expands the DEPENDS_z
override, it removes "DEPENDS_z" from the data store. In the above example this would
mean that it wouldn't matter how often you call d.update_data(), you'd always get
"a c" back.

See the bitbake-devel mailing list for further discussion and analysis of the
potential impact of this change.

(Bitbake rev: 899d45b90061eb3cf3e71029072eee42cd80930c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-06-09 22:43:44 +01:00
Richard Purdie fdead2bfc0 data_smart: Adding overrides of zero length is pointless so lets not
(Bitbake rev: 67434496108efc3aba9cb1e3640bc712658b1408)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-06-01 14:08:40 +01:00
Chris Larson 31521d7484 More 'is' fixups
(Bitbake rev: 967cd1aa2c59f15d805862bd9935f507c635c762)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-03-31 12:23:24 +01:00
Richard Purdie 101b599110 bitbake/data_smart: Improve Variable expansion error handling
If expanding a variable triggers an exception the caller currently has no
way to supress the error message or otherwise handle the siutation. An
example of where this is a problem is "bitbake -e" showing tracebacks and
errors for variables like SRCPV in OE/Poky.

Secondly in a chained expansion fails, log mesages are recorded for
every step of the expansion, not just the innermost error which is
where the real failure occured.

To fix this we introduce a new exception ExpansionError which callers
can handle as appropriate.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-23 13:13:31 +00:00
Richard Purdie 6ea24f04cd bitbake/data_smart: Improve the way lazyassignment works
Currently, if a variable has been set with ??= and the code looks it up
before the data finalisation phase, no value is found. This is causes
serious problems for anonymous python functions which manipulate data, or
for the fetcher revision handling code where revisions can be set with
??=.

There is also a significant performance implication for processing lazy
assignment in finalise.

Moving the check for a default value into getVarFlag addresses both
the timing issue and the performace. This change gives a 7% real time
performance improvement to parsing the Poky metadata. The cost of the
check at this point is minimal since we have all the data flags available.

This should also fix Yocto bug 752.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-23 11:48:01 +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 d951aa40a0 Move LAYERDIR expansion hack into DataSmart
(Bitbake rev: 40778a6e9e82c7ea4673a74fc19574430fa63e8d)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2011-01-04 14:46:52 +00:00
Chris Larson b4eff9fcef build: use bb.process instead of os.system
(Bitbake rev: 53740977521bc81ffa37adfa7bbeb8f2a80ea165)

build: write logfiles per task, not per function
Based on d14f9bf6 from poky, reworked for master and other cleanup.

(Bitbake rev: beadff2eca1eb95f0411115dd72ddb4c3c44c604)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2011-01-04 14:46:48 +00:00
Chris Larson 283b0a20c2 Access metadata vars as locals in python snippets
Example:
FOO = "bar"
BAR = "${@FOO + '/baz'}"

${BAR} == "bar/baz"

(Bitbake rev: 606fa1fd97cbd47a6a7ebdc7a2e6aa93a8f65cf5)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2011-01-04 14:46:38 +00:00
Chris Larson f3406dd288 Fix __getitem__ for DataSmart
Ensure it raises KeyError for a missing key, this is required to use this as a
mapping in various places, e.g. as locals in an eval.

(Bitbake rev: 8d661ce0c303e8d69f17c1d095545d5ed086d1d5)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2011-01-04 14:46:37 +00:00
Chris Larson ecc68fa4fb Switch bitbake internals to use logging directly rather than bb.msg
We use a custom Logger subclass for our loggers

This logger provides:
- 'debug' method which accepts a debug level
- 'plain' method which bypasses log formatting
- 'verbose' method which is more detail than info, but less than debug

(Bitbake rev: 3b2c1fe5ca56daebb24073a9dd45723d3efd2a8d)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2011-01-04 14:46:33 +00:00
Chris Larson 2dd8c01513 Make DataSmart inherit the MutableMapping ABC
Provide __len__, __iter__, and the getitem/setitem/delitem methods, and its
mixed in versions of keys(), values(), items(), etc will automatically behave,
making the DataSmart act more like a real mapping.

(Bitbake rev: 89b5351c656d263b0ce513cee043bc046d20a01e)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2011-01-04 14:46:32 +00:00
Paul Eggleton 80e6408b9f bitbake: add optional expansion to getVarFlag()
Add a parameter to getVarFlag() to auto-expand the value of the flag. This
makes getVarFlag() more consistent with getVar(), and allows expansion of
vardeps and vardepsexclude (which has been done in this commit).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2010-12-14 22:36:19 +00:00
Richard Purdie 7aacc310b5 bitbake/data_smart: Refactor _append/_prepend code to remove duplication
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-12-07 12:25:24 +00:00
Richard Purdie c354955d26 bitbake/data_smart: Fix append/prepend/override ordering issue
Where a variable name consisted of an append/prepend combined with an override
and there was also an append/prepend to the variable, the override could be lost
if the override was not in OVERRIDES.

For example:

FOO = "A"
FOO_append = "B"
FOO_append_virtclass-native = "C"

could result in "AB" even though virtclass-native was in OVERRIDES.

With this patch applied, the result is "ABC" as would be expected.

The problem was the deletion of the _append/_prepend flag was happening
if *any* append/prepend was procesed, the result should really be that
it should contain any unprocessed append/prepend.

Kevin Tian deserves credit for looking into this and working out the
problem here.

Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-12-07 12:16:16 +00: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
Richard Purdie f7627e4f67 bitbake/data_smart.py: Allow the data expand function to keep track of references (including those from python code)
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-08-31 12:06:18 +01:00
Chris Larson 50006b49fc Revert "In expand, drop the unnecessary second regular expression match"
This reverts commit 05462fa7908fc22988b3dc9d376798d0a46ccb5a.

Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-07-02 15:41:34 +01:00
Chris Larson d00b54b948 In expand, drop the unnecessary second regular expression match
(Bitbake rev: 05462fa7908fc22988b3dc9d376798d0a46ccb5a)

Signed-off-by: Imran Mehmood <imran_mehmood@mentor.com>
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-07-02 15:41:34 +01:00
Chris Larson e07a5b1909 Simplify _findVar a bit
(Bitbake rev: b017acd39b811a00305002a8044e7d02e79f41d7)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-07-02 15:41:34 +01:00
Chris Larson 66d66cb487 Fix major bug that slipped in when moving update_data
The root cause is, I was testing the use of renameVar() from finalize, in
order to get flags copied over when an override is applied, but renameVar
removes the original, whereas the old code did not do so.  Going back to the
old method, will revisit the override/flags later on.

(Bitbake rev: 2f7c498abcf675e5b8de197d8056a0581670c2bd)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-07-02 15:41:34 +01:00
Chris Larson 1e7a03cb58 For ${@}, run str() on the result
(Bitbake rev: cf1a51eab11f645c95e5fa278221f78c129b9dd1)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-07-02 15:41:34 +01:00
Chris Larson 22a2179905 Kill unnecessary usages of the types module
types.IntType -> int
types.StringType -> basestring
...

Also moves our ImmutableTypes tuple into our own namespace.

(Bitbake rev: 83674a3a5564ecb1f9d2c9b2d5b1eeb3c31272ab)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-07-02 15:41:33 +01:00
Chris Larson 1180bab54e Apply some 2to3 transforms that don't cause issues in 2.6
(Bitbake rev: d39ab776e7ceaefc8361150151cf0892dcb70d9c)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-07-02 15:41:33 +01:00
Chris Larson cbc8140c77 Exception handling fixups
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-07-02 15:41:33 +01:00
Chris Larson 1c74fd768f Import fixups
(Bitbake rev: 4fa052f426e3205ebace713eaa22deddc0420e8a)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-07-02 15:41:32 +01:00
Chris Larson 7acc132cac Formatting cleanups
(Bitbake rev: 2caf134b43a44dad30af4fbe33033b3c58deee57)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-07-02 15:41:32 +01:00
Chris Larson c9c230b14a Move update_data into the DataSmart class as a finalize() method
(Bitbake rev: ff801397785567cb84b3615de86bff764d65decf)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-07-02 15:41:31 +01:00
Chris Larson 94b60d1247 Consolidate the exec/eval bits, switch anonfunc to better_exec, etc
The methodpool, ${@} expansions, anonymous python functions, event handlers
now all run with the same global context, ensuring a consistent environment
for them.  Added a bb.utils.better_eval function which does an eval() with the
same globals as better_exec.

(Bitbake rev: 424d7e267b009cc19b8503eadab782736d9597d0)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-07-02 15:41:31 +01:00
Chris Larson eb16773704 Pass an empty locals dict in expansion, since list comprehensions apparently leak their '_' helper variable
(Bitbake rev: 97da0cebbaf4dd1b46e58bd2e80cab6c007ae7c9)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-07-02 15:41:31 +01:00
Chris Larson d8c8612d92 Two minor changes to the way python snippet expansion happens
- Use a single dictionary for the context, both global & local, since for some
  reason it chokes wanting a global "d" rather than a local in the metadata.
- First compile the string into a code object before running eval, so we can
  include the variable name in an evaluation error.

(Bitbake rev: 49534d928a37e0804ca84eed186cd22363023b2e)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-07-02 15:41:31 +01:00
Chris Larson 964085f701 data_smart: be explicit about what we make available to eval'd python code
(Bitbake rev: 6a73dda60f50e9b3e5513795d1ec7207d1446de2)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-03-25 17:25:58 +00:00
Chris Larson ada2a8494a Avoid unnecessary calls to keys() when iterating over dictionaries.
dict objects provide an __iter__ method for the iteration which gives you the
keys, so calling keys directly is unnecessary, and isn't really a best
practice.  The only time you really need to call the keys is if there's a
danger of the dict changing out from underneith you, either due to external
forces or due to modification of the iterable in the loop.  Iterations over
os.environ are apparently subject to such changes, so they must continue to
use keys().

As an aside, also switches a couple spots to using sorted() rather than
creating a temporary list with keys() and sorting that.

(Bitbake rev: 5b6ccb16c6e71e23dac6920cd2df994d67c2587b)

Signed-off-by: Chris Larson <clarson@mvista.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-03-22 15:01:59 +00:00
Richard Purdie 459861b9c0 bitbake/data_smart.py: Fix error where update-rc.d would not get added to the dependency tree
If there was a variable such as:

X_${Y}_append = "Z"

The "Z" would be lost if X_${Y} was unset. This was due to a bug in the renameVar
function used by expandKeys().

Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2009-12-16 08:39:47 +00:00
Richard Purdie 81ff3a90f8 bitbake: Update to work without warnings with python 2.6
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2009-05-12 16:53:22 +01:00
Richard Purdie 2e182847e4 bitbake/bitbake-dev: Allow much better control of which variable influence bitbake from the environment
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@5347 311d38ba-8fff-0310-9ca6-ca027cbcb966
2008-09-30 20:57:18 +00:00
Richard Purdie ab191d21e2 bitbake: Update to bitbake 1.8 branch head
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@3892 311d38ba-8fff-0310-9ca6-ca027cbcb966
2008-03-03 22:01:45 +00:00
Richard Purdie 7611768e23 bitbake: Sync with 1.8 head. Adds locking to the fetcher to prevent parallel downloads, fixes key expansion issues and occasional missing dependency graph links
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2502 311d38ba-8fff-0310-9ca6-ca027cbcb966
2007-08-16 09:55:21 +00:00
Richard Purdie f5665d5bfc bitbake: Sync with upstream.
* File licence headers were sanitised causing most of the diff. 
 * cooker.py was created from bin/bitbake. 
 * cvs fetcher port option was added
 * The -f force option was fixed to work correctly
 * Multiple entries in rrecrdeps are now handled correctly
   (allows adding do_deploy to image depends)
 


git-svn-id: https://svn.o-hand.com/repos/poky/trunk@1129 311d38ba-8fff-0310-9ca6-ca027cbcb966
2007-01-08 23:53:01 +00:00
Richard Purdie edd988ecb3 data_smart.py: micro optimisation from bitbake trunk
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@963 311d38ba-8fff-0310-9ca6-ca027cbcb966
2006-11-27 09:15:20 +00:00
Richard Purdie 306b7c7a97 bitbake: Upgrade from 1.4 -> 1.7.4ish
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@863 311d38ba-8fff-0310-9ca6-ca027cbcb966
2006-11-16 15:02:15 +00:00
Richard Purdie 27dba1e624 Update to bitbake 1.4.2 (latest stable branch release). This includes the caching speedups
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@371 311d38ba-8fff-0310-9ca6-ca027cbcb966
2006-05-09 15:44:08 +00:00
Richard Purdie b26a945734 Update to latest bitbake
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@309 311d38ba-8fff-0310-9ca6-ca027cbcb966
2006-03-20 17:45:11 +00:00