mirror of
https://git.yoctoproject.org/poky
synced 2026-05-31 12:49:46 +00:00
bitbake/cooker: terminate when errors found in layer configuration
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). (Bitbake rev: c7486a09310fe63b1aa1b7b0bb9450f306b6093b) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
e894f0e71c
commit
c9e95d3363
@@ -55,6 +55,11 @@ class NothingToBuild(Exception):
|
|||||||
Exception raised when there is nothing to build
|
Exception raised when there is nothing to build
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
class CollectionError(bb.BBHandledException):
|
||||||
|
"""
|
||||||
|
Exception raised when layer configuration is incorrect
|
||||||
|
"""
|
||||||
|
|
||||||
class state:
|
class state:
|
||||||
initial, parsing, running, shutdown, stop = range(5)
|
initial, parsing, running, shutdown, stop = range(5)
|
||||||
|
|
||||||
@@ -893,6 +898,7 @@ class BBCooker:
|
|||||||
|
|
||||||
def handleCollections( self, collections ):
|
def handleCollections( self, collections ):
|
||||||
"""Handle collections"""
|
"""Handle collections"""
|
||||||
|
errors = False
|
||||||
self.status.bbfile_config_priorities = []
|
self.status.bbfile_config_priorities = []
|
||||||
if collections:
|
if collections:
|
||||||
collection_priorities = {}
|
collection_priorities = {}
|
||||||
@@ -907,6 +913,7 @@ class BBCooker:
|
|||||||
prio = int(priority)
|
prio = int(priority)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
parselog.error("invalid value for BBFILE_PRIORITY_%s: \"%s\"", c, priority)
|
parselog.error("invalid value for BBFILE_PRIORITY_%s: \"%s\"", c, priority)
|
||||||
|
errors = True
|
||||||
if min_prio == 0 or prio < min_prio:
|
if min_prio == 0 or prio < min_prio:
|
||||||
min_prio = prio
|
min_prio = prio
|
||||||
collection_priorities[c] = prio
|
collection_priorities[c] = prio
|
||||||
@@ -925,6 +932,7 @@ class BBCooker:
|
|||||||
depver = int(depsplit[1])
|
depver = int(depsplit[1])
|
||||||
except ValueError:
|
except ValueError:
|
||||||
parselog.error("invalid version value in LAYERDEPENDS_%s: \"%s\"", c, dep)
|
parselog.error("invalid version value in LAYERDEPENDS_%s: \"%s\"", c, dep)
|
||||||
|
errors = True
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
depver = None
|
depver = None
|
||||||
@@ -939,13 +947,17 @@ class BBCooker:
|
|||||||
lver = int(layerver)
|
lver = int(layerver)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
parselog.error("invalid value for LAYERVERSION_%s: \"%s\"", c, layerver)
|
parselog.error("invalid value for LAYERVERSION_%s: \"%s\"", c, layerver)
|
||||||
|
errors = True
|
||||||
continue
|
continue
|
||||||
if lver <> depver:
|
if lver <> depver:
|
||||||
parselog.error("Layer dependency %s of layer %s is at version %d, expected %d", dep, c, lver, depver)
|
parselog.error("Layer dependency %s of layer %s is at version %d, expected %d", dep, c, lver, depver)
|
||||||
|
errors = True
|
||||||
else:
|
else:
|
||||||
parselog.error("Layer dependency %s of layer %s has no version, expected %d", dep, c, depver)
|
parselog.error("Layer dependency %s of layer %s has no version, expected %d", dep, c, depver)
|
||||||
|
errors = True
|
||||||
else:
|
else:
|
||||||
parselog.error("Layer dependency %s of layer %s not found", dep, c)
|
parselog.error("Layer dependency %s of layer %s not found", dep, c)
|
||||||
|
errors = True
|
||||||
collection_depends[c] = depnamelist
|
collection_depends[c] = depnamelist
|
||||||
else:
|
else:
|
||||||
collection_depends[c] = []
|
collection_depends[c] = []
|
||||||
@@ -969,13 +981,18 @@ class BBCooker:
|
|||||||
regex = self.configuration.data.getVar("BBFILE_PATTERN_%s" % c, 1)
|
regex = self.configuration.data.getVar("BBFILE_PATTERN_%s" % c, 1)
|
||||||
if regex == None:
|
if regex == None:
|
||||||
parselog.error("BBFILE_PATTERN_%s not defined" % c)
|
parselog.error("BBFILE_PATTERN_%s not defined" % c)
|
||||||
|
errors = True
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
cre = re.compile(regex)
|
cre = re.compile(regex)
|
||||||
except re.error:
|
except re.error:
|
||||||
parselog.error("BBFILE_PATTERN_%s \"%s\" is not a valid regular expression", c, regex)
|
parselog.error("BBFILE_PATTERN_%s \"%s\" is not a valid regular expression", c, regex)
|
||||||
|
errors = True
|
||||||
continue
|
continue
|
||||||
self.status.bbfile_config_priorities.append((c, regex, cre, collection_priorities[c]))
|
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):
|
def buildSetVars(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user