Skip to contentSkip to conversation

cooker: Ensure reparsing is handled correctly

PATCH New Richard Purdie 1 participant 2 messages Feb 9, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 cooker: Ensure reparsing is handled correctly

From tinfoil, if you edit bblayers.conf and break it, then call parseConfiguration (e.g. by adding a bad layer with bitbake-layers), the system doens't show any parse error yet it should.

Add in a call to the updateCache function so that things really are reparsed when requested.

Partially fixes [YOCTO #14054]

---
 lib/bb/cooker.py | 2 ++
 1 file changed, 2 insertions(+)
lib/bb/cooker.py +2 -0
index 4446addc77..67bf925441 100644
@@ -411,6 +411,8 @@ class BBCooker:
             self.data.disableTracking()
 
     def parseConfiguration(self):
+        self.updateCacheSync()
+
         # Change nice level if we're asked to
         nice = self.data.getVar("BB_NICE_LEVEL")
         if nice:
Signature · 1 line
2.27.0
#1 lore raw

PATCH 2/2 bblayers/action: When adding layers, catch BBHandledException

When adding a layer, parse error can occur, raising BBHandledException. Catch this and error, aborting the layer add to meet user expectations.

[YOCTO #14054]

---
 lib/bblayers/action.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/bblayers/action.py +2 -2
index 5b78195ad4..f05f5d330f 100644
@@ -50,10 +50,10 @@ class ActionPlugin(LayerPlugin):
             if not (args.force or notadded):
                 try:
                     self.tinfoil.run_command('parseConfiguration')
-                except bb.tinfoil.TinfoilUIException:
+                except (bb.tinfoil.TinfoilUIException, bb.BBHandledException):
                     # Restore the back up copy of bblayers.conf
                     shutil.copy2(backup, bblayers_conf)
-                    bb.fatal("Parse failure with the specified layer added")
+                    bb.fatal("Parse failure with the specified layer added, aborting.")
                 else:
                     for item in notadded:
                         sys.stderr.write("Specified layer %s is already in BBLAYERS\n" % item)
Signature · 1 line
2.27.0