Skip to contentSkip to conversation

cooker.py: run sanity checks for multiconfig

PATCH In review Juro Bystricky 2 participants 3 messages Jan 12, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 cooker.py: run sanity checks for multiconfig

Also run sanity check for all multiconfig configurations as listed in BBMULTICONFIG.

[YOCTO#10810]

---
 bitbake/lib/bb/cooker.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
bitbake/lib/bb/cooker.py +3 -1
index 182d044..f6bad36 100644
@@ -1610,7 +1610,9 @@ class BBCooker:
         if self.state != state.parsing and not self.parsecache_valid:
             self.parseConfiguration ()
             if CookerFeatures.SEND_SANITYEVENTS in self.featureset:
-                bb.event.fire(bb.event.SanityCheck(False), self.data)
+
+                for mc in self.multiconfigs:
+                    bb.event.fire(bb.event.SanityCheck(False), self.databuilder.mcdata[mc])
 
             for mc in self.multiconfigs:
                 ignore = self.databuilder.mcdata[mc].getVar("ASSUME_PROVIDED") or ""
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/2 sanity.bbclass: Improved error message

When a non-existing MACHINE is specified, sanity check issues the following message:

Please set a valid MACHINE in your local.conf or environment

However, MACHINE can also be set in multiconfig .conf file(s). Hence we may have several different MACHINE settings within one (multiconfig) build, so the present error message is fairly ambiguous.

This patch remedies this by explicitly naming the offending MACHINE and adding conf/multiconfig/*.conf to the list of places where this erroneous MACHINE definition could have originated.

Invalid MACHINE=xyz. Please set a valid MACHINE in your local.conf, conf/multiconfig/*.conf or environment

[YOCTO#10810]

---
 meta/classes/sanity.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/sanity.bbclass +1 -1
index c876dc6..8477d38 100644
@@ -823,7 +823,7 @@ def check_sanity_everybuild(status, d):
     machinevalid = True
     if d.getVar('MACHINE'):
         if not check_conf_exists("conf/machine/${MACHINE}.conf", d):
-            status.addresult('Please set a valid MACHINE in your local.conf or environment\n')
+            status.addresult('Invalid MACHINE=%s. Please set a valid MACHINE in your local.conf, conf/multiconfig/*.conf or environment\n' % (d.getVar('MACHINE')))
             machinevalid = False
         else:
             status.addresult(check_sanity_validmachine(d))
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH 2/2] sanity.bbclass: Improved error message

Quoted 10 lines · Juro Bystricky

When a non-existing MACHINE is specified, sanity check issues the following message:

Please set a valid MACHINE in your local.conf or environment

However, MACHINE can also be set in multiconfig .conf file(s). Hence we may have several different MACHINE settings within one (multiconfig) build, so the present error message is fairly ambiguous.

Quoted 5 lines

This patch remedies this by explicitly naming the offending MACHINE and adding conf/multiconfig/*.conf to the list of places where this erroneous MACHINE definition could have originated.

Invalid MACHINE=xyz. Please set a valid MACHINE in your local.conf, conf/multiconfig/*.conf or environment

(I don't have any problem with the change, but I do have a suggestion that may make it better.)

I'm not sure if it's available without specifically using the bitbake -e flag, but we do usually capture where variables are defined. Could this be used to provide a better error message for the user?

i.e. bitbake -e output:

# $MACHINE [3 operations]
# set /home/mhatle/oe/build/conf/local.conf:76
# [_defaultval] "qemux86-64"
# set /home/mhatle/oe/meta/conf/documentation.co
nf:274
# [doc] "Specifies the target device for which the image is built. You defin
e MACHINE in the conf/local.conf file in the Build Directory."
# set /home/mhatle/oe/meta/conf/bitbake.conf:795
# [unexport] "1"

# pre-expansion value:
#   "qemux86-64"
unset MACHINE

in this case it knows it was defined in the local.conf on line 76.

... and if I set it in the environment:

# $MACHINE [4 operations]
# from env data.py:177 [inheritFromOS]
# "foobar"
# set /home/mhatle/oe/build/conf/local.conf:76
# [_defaultval] "qemux86-64"
# set /home/mhatle/oe/meta/conf/documentation.co
nf:274
# [doc] "Specifies the target device for which the image is built. You defin
e MACHINE in the conf/local.conf file in the Build Directory."
# set /home/mhatle/oe/meta/conf/bitbake.conf:795
# [unexport] "1"

# pre-expansion value:
#   "foobar"
unset MACHINE

It knows it was 'inheritFromOS'.

--Mark

Quoted 21 lines

[YOCTO#10810]

---
 meta/classes/sanity.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/sanity.bbclass +1 -1
index c876dc6..8477d38 100644
@@ -823,7 +823,7 @@ def check_sanity_everybuild(status, d):
     machinevalid = True
     if d.getVar('MACHINE'):
         if not check_conf_exists("conf/machine/${MACHINE}.conf", d):
-            status.addresult('Please set a valid MACHINE in your local.conf or environment\n')
+            status.addresult('Invalid MACHINE=%s. Please set a valid MACHINE in your local.conf, conf/multiconfig/*.conf or environment\n' % (d.getVar('MACHINE')))
             machinevalid = False
         else:
             status.addresult(check_sanity_validmachine(d))