Skip to contentSkip to conversation

Tracking parsed configuration files v2

RFC PATCH In review Joshua Lock 2 participants 4 messages Aug 1, 2011 – Aug 2, 2011

lore
Share & tools
lore
#0 lore raw

cover Tracking parsed configuration files v2

Since v1 I've switched to hooking into the parser itself and storeing a list of parsed configuration files as the parsing happens.

Hopefully a little less ugly and certainly a lot less hacky than the last attempt.

Please review the following changes for suitability for inclusion. If you have any objections or suggestions for improvement, please respond to the patches. If you agree with the changes, please provide your Acked-by.

The following changes since commit c9dd2592434338bdddb3cc6f42e760c86fa9e6bb:

hob: fix save/restore of toolchain preferences (2011-07-28 10:58:07 -0700)

are available in the git repository at:
git://github.com/incandescant/bitbake configfiles
https://github.com/incandescant/bitbake/tree/configfiles

Joshua Lock (1):
cooker: store a list of parsed configuration files

 lib/bb/cooker.py                     |    3 +++
 lib/bb/parse/parse_py/ConfHandler.py |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)
Signature · 1 line
1.7.6
#1 lore raw

RFC PATCH 1/1 cooker: store a list of parsed configuration files

---
 lib/bb/cooker.py                     |    3 +++
 lib/bb/parse/parse_py/ConfHandler.py |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)
lib/bb/cooker.py +3 -0
index 025dfe4..c7142e1 100644
@@ -772,6 +772,9 @@ class BBCooker:
         for p in postfiles:
             data = _parse(p, data)
 
+        self.configuration.parsed_configuration = (bb.data.getVar('PARSED_CONF', data) or '').split(':')
+        bb.data.delVar('PARSED_CONF', data)
+
         # Handle any INHERITs and inherit the base class
         bbclasses  = ["base"] + (data.getVar('INHERIT', True) or "").split()
         for bbclass in bbclasses:
lib/bb/parse/parse_py/ConfHandler.py +3 -0
index 102c0e9..22686b7 100644
@@ -103,6 +103,9 @@ def handle(fn, data, include):
 
     # DONE WITH PARSING... time to evaluate
     bb.data.setVar('FILE', fn, data)
+    conf_files = bb.data.getVar('PARSED_CONF', data) or ''
+    bb.data.setVar('PARSED_CONF', "%s:%s" % (conf_files, abs_fn), data)
+
     statements.eval(data)
     if oldfile:
         bb.data.setVar('FILE', oldfile, data)
Signature · 1 line
1.7.6
#2 lore raw

Re: [RFC PATCH 1/1] cooker: store a list of parsed configuration files

Quoted 25 lines · Joshua Lock
---
 lib/bb/cooker.py                     |    3 +++
 lib/bb/parse/parse_py/ConfHandler.py |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)
lib/bb/cooker.py +3 -0
index 025dfe4..c7142e1 100644
@@ -772,6 +772,9 @@ class BBCooker:
         for p in postfiles:
             data = _parse(p, data)
 
+        self.configuration.parsed_configuration = (bb.data.getVar('PARSED_CONF', data) or '').split(':')
+        bb.data.delVar('PARSED_CONF', data)
+
         # Handle any INHERITs and inherit the base class
         bbclasses  = ["base"] + (data.getVar('INHERIT', True) or "").split()
         for bbclass in bbclasses:
lib/bb/parse/parse_py/ConfHandler.py +0 -0
index 102c0e9..22686b7 100644

lib/bb/parse/parse_py/ConfHandler.py def handle(fn, data, include): · line 111

Quoted 9 lines
lib/bb/parse/parse_py/ConfHandler.py +3 -0
@@ -103,6 +103,9 @@ def handle(fn, data, include):
 
     # DONE WITH PARSING... time to evaluate
     bb.data.setVar('FILE', fn, data)
+    conf_files = bb.data.getVar('PARSED_CONF', data) or ''
+    bb.data.setVar('PARSED_CONF', "%s:%s" % (conf_files, abs_fn), data)
+
     statements.eval(data)
     if oldfile:
         bb.data.setVar('FILE', oldfile, data)

Hmm, this isn't particularly nice :/

At the very least call the variable __BB<something> to indicate its internal.

Did you find and have a look at the internal __depends and __base_depends variables?

Cheers,

Richard

#3 lore raw

Re: [RFC PATCH 1/1] cooker: store a list of parsed configuration files

Quoted 38 lines · Richard Purdie
Quoted 25 lines · Joshua Lock
---
 lib/bb/cooker.py                     |    3 +++
 lib/bb/parse/parse_py/ConfHandler.py |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)
lib/bb/cooker.py +3 -0
index 025dfe4..c7142e1 100644
@@ -772,6 +772,9 @@ class BBCooker:
         for p in postfiles:
             data = _parse(p, data)
 
+        self.configuration.parsed_configuration = (bb.data.getVar('PARSED_CONF', data) or '').split(':')
+        bb.data.delVar('PARSED_CONF', data)
+
         # Handle any INHERITs and inherit the base class
         bbclasses  = ["base"] + (data.getVar('INHERIT', True) or "").split()
         for bbclass in bbclasses:
lib/bb/parse/parse_py/ConfHandler.py +0 -0
index 102c0e9..22686b7 100644

lib/bb/parse/parse_py/ConfHandler.py def handle(fn, data, include): · line 111

Quoted 9 lines
lib/bb/parse/parse_py/ConfHandler.py +3 -0
@@ -103,6 +103,9 @@ def handle(fn, data, include):
 
     # DONE WITH PARSING... time to evaluate
     bb.data.setVar('FILE', fn, data)
+    conf_files = bb.data.getVar('PARSED_CONF', data) or ''
+    bb.data.setVar('PARSED_CONF', "%s:%s" % (conf_files, abs_fn), data)
+
     statements.eval(data)
     if oldfile:
         bb.data.setVar('FILE', oldfile, data)

Hmm, this isn't particularly nice :/

Quoted 5 lines

At the very least call the variable __BB<something> to indicate its internal.

Did you find and have a look at the internal __depends and __base_depends variables?

I see them, that does seem like a more explicit and therefore cleaner way of achieving this.

There'll be a series out shortly inspired by that and using an internal namespace on the variable.

Cheers,
Joshua

Signature · 3 lines
Joshua Lock
        Yocto Project "Johannes factotum"
        Intel Open Source Technology Centre