Bug 11017

Summary: wic: per-image native tool dependencies
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Patrick Ohly <patrick.ohly>
Component: Scripts and ToolsAssignee: Patrick Ohly <patrick.ohly>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: mikko.ylinen, ross.burton, srifenbark
Version: unspecified   
Target Milestone: 2.3 M4   
Hardware: x86   
OS: Multiple   
Whiteboard: 04 April 2017: RESOLVED
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Done (doc changes complete)

Description Patrick Ohly 2017-02-06 16:19:37 UTC
Image recipes can specify their own .wks files, and that file might use a custom source plugin. Currently there is no way to specify a dependency on native tools used by such a plugin without modifying the distro config of how wic-tools gets built.

The approch that Ed and I discussed on IRC is to let wic check the native sysroot of the current image recipe first, then fall back to the sysroot of wic-tools.

Ed, bonus points if those dependencies only get added to DEPENDS of the image recipe when the "wic" image type is really active.

Something like (untested):
my-image.bb:
WKS_FILE_DEPENDS = "some-tool-native"

image_types_wic.bbclass:
WKS_FILE_DEPENDS ??= ''
DEPENDS += "${@ '${WKS_FILE_DEPENDS}' if d.getVar('USING_WIC') else '' }"
Comment 1 Patrick Ohly 2017-02-06 16:20:59 UTC
While at it, also enhance the error message in exec_native_cmd() such that it is more obvious where the command was searched. I had to extend the output before I realized why my image recipe's DEPENDS was not having an effect.
Comment 2 Ed Bartosh 2017-02-21 15:32:44 UTC
Fix has been sent to the mailing list for review: http://lists.openembedded.org/pipermail/openembedded-core/2017-February/133080.html
Comment 3 Ed Bartosh 2017-02-21 15:35:22 UTC
Scott, can you help us to add WKS_FILE_DEPENDS to the documentation, please?
Comment 4 Scott Rifenbark 2017-02-28 17:51:37 UTC
Ed, 

Yes - can you send me a base description of the variable?  It doesn't have to be polished.  Just make sure you include information on how a user applies it (i.e. conf file?) and what the possible values are and what effects they have.  I will create a glossary entry for the variable and see about integrating it into wics documentation appropriately. 

Scott
Comment 5 Ed Bartosh 2017-02-28 19:04:12 UTC
Here is what I came up with. Patrick, feel free to suggest better description.

WKS_FILE_DEPENDS[doc] = "Lists a recipe's build-time dependencies specific to wic."

This variable is similar to DEPENDS variable. It lists build-time dependencies that will be used only when wic images are active,
i.e. when IMAGE_FSTYPES variable contains wic related entries.
In this case dependencies mentioned in WIC_FILE_DEPENDS variable will be added to DEPENDS variable. If wic images are not active this variable
doesn't influence the build.

This approach gives recipe developer a possibility to specify list of additional dependencies that are required to build wic images: native tools, bootloaders, etc.
Comment 6 Ed Bartosh 2017-03-06 11:39:53 UTC
The patchset has been merged to master.
Comment 7 Scott Rifenbark 2017-03-20 16:40:05 UTC
Hi Patrick, 

I have created a new variable glossary definition for WKS_FILE_DEPENDS in the ref-manual at http://www.yoctoproject.org/docs/2.3/ref-manual/ref-manual.html#var-WKS_FILE_DEPENDS.  Check it out and let me know if it is okay.  If not, we can adjust it.

Also, in the dev-manual in the section that covers how to use Wic, I added a small note in the "Plug-ins" section to cross-reference to the variable in context.  See http://www.yoctoproject.org/docs/2.3/dev-manual/dev-manual.html#openembedded-kickstart-plugins.

One thing I noticed in your original Comment 1 is that a class "image_types_wic.bbclass" is mentioned.  We have a reference section for classes in the ref-manual and we do not document this class.  Does the user have to alter this class in order to get dependencies to work as well?  If so, we probably should list that class in the reference.  

I am REOPENING the bug since there is a documentation component.  Also putting the target to 2.3 M4.

Please review and send me your feedback here. 

Thanks,
Scott
Comment 8 Scott Rifenbark 2017-03-20 17:51:33 UTC
Setting to 2.3 M4 and putting at IN PROGRESS REVIEW
Comment 9 Scott Rifenbark 2017-03-27 21:27:36 UTC
Still need some input on my question in Comment 7.

Setting to NEEDINFO.

Scott
Comment 10 Patrick Ohly 2017-04-04 07:41:18 UTC
(In reply to comment #7)
> Hi Patrick, 
> 
> I have created a new variable glossary definition for WKS_FILE_DEPENDS in
> the ref-manual at
> http://www.yoctoproject.org/docs/2.3/ref-manual/ref-manual.html#var-
> WKS_FILE_DEPENDS.  Check it out and let me know if it is okay.  If not, we
> can adjust it.
> 
> Also, in the dev-manual in the section that covers how to use Wic, I added a
> small note in the "Plug-ins" section to cross-reference to the variable in
> context.  See
> http://www.yoctoproject.org/docs/2.3/dev-manual/dev-manual.html#openembedded-
> kickstart-plugins.

Both looks good.

> One thing I noticed in your original Comment 1 is that a class
> "image_types_wic.bbclass" is mentioned.  We have a reference section for
> classes in the ref-manual and we do not document this class.  Does the user
> have to alter this class in order to get dependencies to work as well?

No. It's an internal helper class that users typically won't interact with.
Comment 11 Scott Rifenbark 2017-04-04 19:22:19 UTC
Thanks Patrick.

I am going to mark the doc flag as "done."

Scott