Skip to contentSkip to conversation

Config re-parse improvements

PATCH New Markus Lehtonen 1 participant 3 messages Sep 15, 2016

lore
Share & tools
lore
#0 lore raw

cover Config re-parse improvements

These two patches improve config (re-)parsing by allowing multiple passes of re-parse.

The following changes since commit 57912de63fa83550c0ae658eb99b76e9cc91a8d1:

cooker: record events on cooker exit (2016-09-06 10:36:34 +0100)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib marquiz/bitbake/fixes-10188
http://git.openembedded.org/openembedded-core-contrib/log/?h=marquiz/bitbake/fixes-10188

Markus Lehtonen (2):
cookerdata: fire ConfigParsed event after re-parse
cookerdata: allow multiple passes of config re-parsing

 lib/bb/cookerdata.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
Signature · 1 line
2.6.6
#1 lore raw

PATCH 1/2 cookerdata: fire ConfigParsed event after re-parse

[YOCTO #10188]

---
 lib/bb/cookerdata.py | 1 +
 1 file changed, 1 insertion(+)
lib/bb/cookerdata.py +1 -0
index bf9bfbf..07425ce 100644
@@ -273,6 +273,7 @@ class CookerDataBuilder(object):
             if self.data.getVar("BB_INVALIDCONF", False) is True:
                 self.data.setVar("BB_INVALIDCONF", False)
                 self.data = self.parseConfigurationFiles(self.prefiles, self.postfiles)
+                bb.event.fire(bb.event.ConfigParsed(), self.data)
 
             bb.parse.init_parser(self.data)
             self.data_hash = self.data.get_hash()
Signature · 1 line
2.6.6
#2 lore raw

PATCH 2/2 cookerdata: allow multiple passes of config re-parsing

In reply to Markus Lehtonen

[YOCTO #10188]

---
 lib/bb/cookerdata.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
lib/bb/cookerdata.py +8 -1
index 07425ce..9e88f95 100644
@@ -270,9 +270,16 @@ class CookerDataBuilder(object):
 
             bb.event.fire(bb.event.ConfigParsed(), self.data)
 
-            if self.data.getVar("BB_INVALIDCONF", False) is True:
+            reparse_cnt = 0
+            while self.data.getVar("BB_INVALIDCONF", False) is True:
+                if reparse_cnt > 20:
+                    logger.error("Configuration has been re-parsed over 20 times, "
+                                 "breaking out of the loop...")
+                    raise Exception("Too deep config re-parse loop. Check locations where "
+                                    "BB_INVALIDCONF is being set (ConfigParsed event handlers)")
                 self.data.setVar("BB_INVALIDCONF", False)
                 self.data = self.parseConfigurationFiles(self.prefiles, self.postfiles)
+                reparse_cnt += 1
                 bb.event.fire(bb.event.ConfigParsed(), self.data)
 
             bb.parse.init_parser(self.data)
Signature · 1 line
2.6.6