diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2012-02-24 18:36:42 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-02-24 23:30:27 +0000 |
commit | c9e95d3363d28ae92eb9ed1ed560ad3769482f8a (patch) | |
tree | 91e0ee308d1e8add3160c8de8bfbc85a32388c3d /bitbake | |
parent | e894f0e71cbea6f1ca4216f692df2833708080b3 (diff) | |
download | poky-c9e95d3363d28ae92eb9ed1ed560ad3769482f8a.tar.gz |
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>
Diffstat (limited to 'bitbake')
-rw-r--r-- | 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 d645454c7c..12b526b40c 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -55,6 +55,11 @@ class NothingToBuild(Exception): | |||
55 | Exception raised when there is nothing to build | 55 | Exception raised when there is nothing to build |
56 | """ | 56 | """ |
57 | 57 | ||
58 | class CollectionError(bb.BBHandledException): | ||
59 | """ | ||
60 | Exception raised when layer configuration is incorrect | ||
61 | """ | ||
62 | |||
58 | class state: | 63 | class state: |
59 | initial, parsing, running, shutdown, stop = range(5) | 64 | initial, parsing, running, shutdown, stop = range(5) |
60 | 65 | ||
@@ -893,6 +898,7 @@ class BBCooker: | |||
893 | 898 | ||
894 | def handleCollections( self, collections ): | 899 | def handleCollections( self, collections ): |
895 | """Handle collections""" | 900 | """Handle collections""" |
901 | errors = False | ||
896 | self.status.bbfile_config_priorities = [] | 902 | self.status.bbfile_config_priorities = [] |
897 | if collections: | 903 | if collections: |
898 | collection_priorities = {} | 904 | collection_priorities = {} |
@@ -907,6 +913,7 @@ class BBCooker: | |||
907 | prio = int(priority) | 913 | prio = int(priority) |
908 | except ValueError: | 914 | except ValueError: |
909 | parselog.error("invalid value for BBFILE_PRIORITY_%s: \"%s\"", c, priority) | 915 | parselog.error("invalid value for BBFILE_PRIORITY_%s: \"%s\"", c, priority) |
916 | errors = True | ||
910 | if min_prio == 0 or prio < min_prio: | 917 | if min_prio == 0 or prio < min_prio: |
911 | min_prio = prio | 918 | min_prio = prio |
912 | collection_priorities[c] = prio | 919 | collection_priorities[c] = prio |
@@ -925,6 +932,7 @@ class BBCooker: | |||
925 | depver = int(depsplit[1]) | 932 | depver = int(depsplit[1]) |
926 | except ValueError: | 933 | except ValueError: |
927 | parselog.error("invalid version value in LAYERDEPENDS_%s: \"%s\"", c, dep) | 934 | parselog.error("invalid version value in LAYERDEPENDS_%s: \"%s\"", c, dep) |
935 | errors = True | ||
928 | continue | 936 | continue |
929 | else: | 937 | else: |
930 | depver = None | 938 | depver = None |
@@ -939,13 +947,17 @@ class BBCooker: | |||
939 | lver = int(layerver) | 947 | lver = int(layerver) |
940 | except ValueError: | 948 | except ValueError: |
941 | parselog.error("invalid value for LAYERVERSION_%s: \"%s\"", c, layerver) | 949 | parselog.error("invalid value for LAYERVERSION_%s: \"%s\"", c, layerver) |
950 | errors = True | ||
942 | continue | 951 | continue |
943 | if lver <> depver: | 952 | if lver <> depver: |
944 | parselog.error("Layer dependency %s of layer %s is at version %d, expected %d", dep, c, lver, depver) | 953 | parselog.error("Layer dependency %s of layer %s is at version %d, expected %d", dep, c, lver, depver) |
954 | errors = True | ||
945 | else: | 955 | else: |
946 | parselog.error("Layer dependency %s of layer %s has no version, expected %d", dep, c, depver) | 956 | parselog.error("Layer dependency %s of layer %s has no version, expected %d", dep, c, depver) |
957 | errors = True | ||
947 | else: | 958 | else: |
948 | parselog.error("Layer dependency %s of layer %s not found", dep, c) | 959 | parselog.error("Layer dependency %s of layer %s not found", dep, c) |
960 | errors = True | ||
949 | collection_depends[c] = depnamelist | 961 | collection_depends[c] = depnamelist |
950 | else: | 962 | else: |
951 | collection_depends[c] = [] | 963 | collection_depends[c] = [] |
@@ -969,13 +981,18 @@ class BBCooker: | |||
969 | regex = self.configuration.data.getVar("BBFILE_PATTERN_%s" % c, 1) | 981 | regex = self.configuration.data.getVar("BBFILE_PATTERN_%s" % c, 1) |
970 | if regex == None: | 982 | if regex == None: |
971 | parselog.error("BBFILE_PATTERN_%s not defined" % c) | 983 | parselog.error("BBFILE_PATTERN_%s not defined" % c) |
984 | errors = True | ||
972 | continue | 985 | continue |
973 | try: | 986 | try: |
974 | cre = re.compile(regex) | 987 | cre = re.compile(regex) |
975 | except re.error: | 988 | except re.error: |
976 | parselog.error("BBFILE_PATTERN_%s \"%s\" is not a valid regular expression", c, regex) | 989 | parselog.error("BBFILE_PATTERN_%s \"%s\" is not a valid regular expression", c, regex) |
990 | errors = True | ||
977 | continue | 991 | continue |
978 | self.status.bbfile_config_priorities.append((c, regex, cre, collection_priorities[c])) | 992 | self.status.bbfile_config_priorities.append((c, regex, cre, collection_priorities[c])) |
993 | if errors: | ||
994 | # We've already printed the actual error(s) | ||
995 | raise CollectionError("Errors during parsing layer configuration") | ||
979 | 996 | ||
980 | def buildSetVars(self): | 997 | def buildSetVars(self): |
981 | """ | 998 | """ |