Bug 9058

Summary: Bad project MACHINE setting in conf/toaster.conf causes command line builds to fail
Product: [Build System, Metadata & Runtime] Toaster Reporter: Elliot Smith <elliot.smith>
Component: toasterAssignee: Ed Bartosh <eduard.bartosh>
Status: VERIFIED FIXED QA Contact: Alexandru Roman <alexandru.costinx.roman>
Severity: normal    
Priority: Medium CC: alexandru.costinx.roman, belen.barros.pena, brian.avery, jessica.zhang, stanciux.mihail
Version: unspecified   
Target Milestone: 2.1   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Bug Depends on: 7880    
Bug Blocks:    

Description Elliot Smith 2016-02-04 14:36:50 UTC
Because we now write our configuration out to conf/toaster.conf when we do setVariable() on the bitbake server, bad configuration in a Toaster project can cause command line builds to fail.

To reproduce:

1. Create a Toaster project and set the MACHINE variable to a bad value (e.g. 'xsxsxsx') via the Toaster UI.
2. Run a build for that project, e.g. "zlib".
3. Go out to the command line (the same environment where you started Toaster from). Note that conf/toaster.conf now has MACHINE="xsxsxsx" (bad).
4. Run a command-line build, e.g. "bitbake zlib".

The build will fail with this error:

--------------------------------
ERROR:  OE-core's config sanity checker detected a potential misconfiguration.
    Either fix the cause of this error or at your own risk disable the checker (see sanity.conf).
    Following is the list of potential problems / advisories:

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

I imagine other bad settings in the Toaster project will have the same effect on command-line builds and also cause them to fail.

Note that other Toaster projects are not affected, as they rewrite the config file before their builds run (via the LocalhostBEController.triggerBuild() method).

I suggest we find a way to isolate project settings from each other, and from command-line builds.
Comment 1 Elliot Smith 2016-02-04 14:38:02 UTC
Note that command line builds currently get mixed up with project builds because of bug 9021, so in Toaster the failed command-line build will merge into the last project build.
Comment 2 Belen Barros Pena 2016-02-04 14:41:29 UTC
Wouldn't this be fixed by bug 7880? The moment Toaster creates a separate build directory per project, we shouldn't see this kind of cross-contamination between projects... I hope :/
Comment 3 Elliot Smith 2016-02-04 15:35:51 UTC
Providing the configuration is also stored in the project directory, it might. But the problem may be that we run one bitbake server for all projects, so there may still be configuration shared between them. Perhaps if we ran one bitbake per project, we might be OK, but that's not covered by bug 7880 and I'm not sure it's even possible.
Comment 4 Elliot Smith 2016-02-10 16:17:25 UTC
NB we write to conf/local.conf, which is why failures then affect the command-line builds. In the original bug report I put conf/toaster.conf, which was incorrect.
Comment 5 Elliot Smith 2016-02-10 16:24:34 UTC
Actually, I was correct first time: our settings are written to conf/toaster.conf but they are picked up by command-line builds.
Comment 6 brian avery 2016-02-10 21:33:32 UTC
So, a question:
Does anyone know/recall why we are feeding our toaster settings into the bitbake server via a --read conf/toasterconf.json command line argument?
---
Why I am asking:
The following works:
1) start toaster as follows:
BB_ENV_EXTRAWHITE="TOASTER_UI" . ~/src/myBugs/poky/bitbake/bin/toaster start
2) put the following at the end of the conf/local/conf file:
# this will pull in the cowUI.inc when the TOASTER_UI env var is set
# for instance when the Toaster ui is running a build and will pull in 
# the cowNOUI.inc otherwise
require ${@ 'cowUI' if d.getVar('TOASTER_UI') else 'cowNOUI'}.inc

3) from the cli: you can run
BB_ENV_EXTRAWHITE="TOASTER_UI" TOASTER_UI=1 bitbake zlib
 -- this will give you a buidl using all the toaster configuration settings
-or-
bitbake zlib
  -- this will give you a std cli build that does not use toaster variable settings but is recorded/seen by toaster
----
It seems to me that we can use this approach to separate the cli and toaster_ui type builds more cleanly and without the --read <foo> hiding in the background.

Hope this is kinda coherent....
-b
Comment 7 Ed Bartosh 2016-02-22 12:22:43 UTC
The only reason I see to use conf/toaster.conf is to avoid updating local.conf

This bug will be automatically fixed when bug 7880 is fixed.

Brian, we can use your idea as well, but do we really need it if we're going to use unique build directory for project builds?
Comment 8 brian avery 2016-02-22 15:31:12 UTC
No, I don't think we need it at this point. I was playing with the memres server and was just wondering about the toaster.conf approach. I agree 7880 will fix it automagically.
Comment 9 Ed Bartosh 2016-03-08 16:39:21 UTC
This patchset should fix the issue: https://lists.yoctoproject.org/pipermail/toaster/2016-March/004093.html
Comment 10 Ed Bartosh 2016-04-07 08:22:03 UTC
The fix has been merged to bitbake master: http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=a43a16b9fd471d719761354eaab81409d4b07470
Comment 11 Alexandru Roman 2016-05-13 12:49:21 UTC
Verified on master.