All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] terminate when errors found in layer configuration
@ 2012-02-24 18:36 Paul Eggleton
  2012-02-24 18:36 ` [PATCH 1/1] bitbake/cooker: " Paul Eggleton
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Eggleton @ 2012-02-24 18:36 UTC (permalink / raw)
  To: bitbake-devel

A single patch to ensure we stop parsing when errors are found in
the layer configuration.
 
The patch (against poky, but applies cleanly with -p2 against bitbake
master)  is available in the git repository at:
  git://git.yoctoproject.org/poky-contrib paule/bitbake-errors3
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=paule/bitbake-errors3

Paul Eggleton (1):
  bitbake/cooker: terminate when errors found in layer configuration

 bitbake/lib/bb/cooker.py |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

-- 
1.7.5.4




^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/1] bitbake/cooker: terminate when errors found in layer configuration
  2012-02-24 18:36 [PATCH 0/1] terminate when errors found in layer configuration Paul Eggleton
@ 2012-02-24 18:36 ` Paul Eggleton
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggleton @ 2012-02-24 18:36 UTC (permalink / raw)
  To: bitbake-devel

If we find an error in the layer configuration (such as an unsatisfied
item in LAYERDEPENDS) then exit by raising an exception at the end of
handleCollections() (without producing a backtrace).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 bitbake/lib/bb/cooker.py |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index d645454..12b526b 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -55,6 +55,11 @@ class NothingToBuild(Exception):
     Exception raised when there is nothing to build
     """
 
+class CollectionError(bb.BBHandledException):
+    """
+    Exception raised when layer configuration is incorrect
+    """
+
 class state:
     initial, parsing, running, shutdown, stop = range(5)
 
@@ -893,6 +898,7 @@ class BBCooker:
 
     def handleCollections( self, collections ):
         """Handle collections"""
+        errors = False
         self.status.bbfile_config_priorities = []
         if collections:
             collection_priorities = {}
@@ -907,6 +913,7 @@ class BBCooker:
                         prio = int(priority)
                     except ValueError:
                         parselog.error("invalid value for BBFILE_PRIORITY_%s: \"%s\"", c, priority)
+                        errors = True
                     if min_prio == 0 or prio < min_prio:
                         min_prio = prio
                     collection_priorities[c] = prio
@@ -925,6 +932,7 @@ class BBCooker:
                                 depver = int(depsplit[1])
                             except ValueError:
                                 parselog.error("invalid version value in LAYERDEPENDS_%s: \"%s\"", c, dep)
+                                errors = True
                                 continue
                         else:
                             depver = None
@@ -939,13 +947,17 @@ class BBCooker:
                                         lver = int(layerver)
                                     except ValueError:
                                         parselog.error("invalid value for LAYERVERSION_%s: \"%s\"", c, layerver)
+                                        errors = True
                                         continue
                                     if lver <> depver:
                                         parselog.error("Layer dependency %s of layer %s is at version %d, expected %d", dep, c, lver, depver)
+                                        errors = True
                                 else:
                                     parselog.error("Layer dependency %s of layer %s has no version, expected %d", dep, c, depver)
+                                    errors = True
                         else:
                             parselog.error("Layer dependency %s of layer %s not found", dep, c)
+                            errors = True
                     collection_depends[c] = depnamelist
                 else:
                     collection_depends[c] = []
@@ -969,13 +981,18 @@ class BBCooker:
                 regex = self.configuration.data.getVar("BBFILE_PATTERN_%s" % c, 1)
                 if regex == None:
                     parselog.error("BBFILE_PATTERN_%s not defined" % c)
+                    errors = True
                     continue
                 try:
                     cre = re.compile(regex)
                 except re.error:
                     parselog.error("BBFILE_PATTERN_%s \"%s\" is not a valid regular expression", c, regex)
+                    errors = True
                     continue
                 self.status.bbfile_config_priorities.append((c, regex, cre, collection_priorities[c]))
+        if errors:
+            # We've already printed the actual error(s)
+            raise CollectionError("Errors during parsing layer configuration")
 
     def buildSetVars(self):
         """
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-24 18:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-24 18:36 [PATCH 0/1] terminate when errors found in layer configuration Paul Eggleton
2012-02-24 18:36 ` [PATCH 1/1] bitbake/cooker: " Paul Eggleton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.