Bug 11274 - PACKAGE_WRITE_DEPS + pkg scripts dependencies need to be documented
Summary: PACKAGE_WRITE_DEPS + pkg scripts dependencies need to be documented
Status: RESOLVED FIXED
Alias: None
Product: Reference
Classification: Documentation
Component: handbook (show other bugs)
Version: 2.3
Hardware: x86 Multiple
: Undecided normal
Target Milestone: 2.3 M4
Assignee: Scott Rifenbark
QA Contact:
URL:
Whiteboard: 04 April 2017: RESOLVED
Depends on:
Blocks:
 
Reported: 2017-03-31 07:46 UTC by Patrick Ohly
Modified: 2017-04-18 16:10 UTC (History)
6 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Done (doc changes complete)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Ohly 2017-03-31 07:46:55 UTC
Recipes which have pkg_postinst scripts have to use PACKAGE_WRITE_DEPS to define dependencies on any non-standard native tool that might be required during rootfs construction, otherwise the tool might be missing and execution of the postinst gets deferred to first boot, which is undesirable and not even possible in a read-only rootfs.

This variable and the general concept (how to define dependencies of scripts) needs to be explained in http://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#new-recipe-post-installation-scripts

See also http://stackoverflow.com/questions/43067776/linux-capabilities-with-yocto/43109887#43109887 which has a real example.

For more information on PACKAGE_WRITE_DEPS and how it is used, see 

commit aff8ca95b8303a4a2a5600c0d8ec0a50ad677258
Author: Richard Purdie <richard.purdie@linuxfoundation.org>
Date:   Thu Jan 19 16:49:00 2017 +0000

    classes/package*: Add support for PACKAGE_WRITE_DEPS
    
    Add a new variable to allow markup of postinstall (and preinst)
    script dependnecies on native/cross tools.
    
    If your postinstall can execute at rootfs creation time rather than on
    target but depends on a native tool in order to execute, you need to
    list that tool in PACKAGE_WRITE_DEPENDS.
    
    Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Comment 1 Scott Rifenbark 2017-04-03 19:03:33 UTC
Hi Patrick, 

See http://www.yoctoproject.org/docs/2.3/dev-manual/dev-manual.html#new-recipe-post-installation-scripts for a new paragraph at the end of the section for describing this situation.

See http://www.yoctoproject.org/docs/2.3/ref-manual/ref-manual.html#var-PACKAGE_WRITE_DEPS for the new glossary entry for PACKAGE_WRITE_DEPS.

Please read them over and let me know of any adjustments. 

Thanks, 
Scott
Comment 2 Patrick Ohly 2017-04-04 07:52:49 UTC
(In reply to comment #1)
> Hi Patrick, 
> 
> See
> http://www.yoctoproject.org/docs/2.3/dev-manual/dev-manual.html#new-recipe-
> post-installation-scripts for a new paragraph at the end of the section for
> describing this situation.

The "Note: Equivalent support for pre-install, pre-uninstall..." might be misunderstood as referring to PACKAGE_WRITE_DEPS in the preceding paragraph, which then begs the question of whether there are separate variables for those.

I would reorder and slightly reword as:

The previous example delays execution until the image boots again because the environment variable D points to the directory containing the image when the root filesystem is created at build time but is unset when executed on the first boot.

Note
Equivalent support for pre-install, pre-uninstall, and post-uninstall scripts ....

If you have recipes that use [PO: pkg_postinst deleted here] scripts and they require the use of non-standard native tools that have dependencies during rootfs construction, you need to use the PACKAGE_WRITE_DEPS variable in your recipe to list these tools. If you do not use this variable, the tools might be missing and execution of the post-installation script is deferred until first boot. Deferring the script to first boot is undesirable and for read-only rootfs impossible. 


> See
> http://www.yoctoproject.org/docs/2.3/ref-manual/ref-manual.html#var-
> PACKAGE_WRITE_DEPS for the new glossary entry for PACKAGE_WRITE_DEPS.

Looks good.
Comment 3 Scott Rifenbark 2017-04-04 19:23:31 UTC
Thanks Patrick, 

Setting to RESOLVED and marking the doc flag as "done."

Scott
Comment 4 Sherif Mousa 2017-04-18 16:00:58 UTC
Hello,

I know this bug is solved and closed, but I'm sorry I'm facing a problem with an old version of Yocto.

Can you please check my question on stackoverflow:
http://stackoverflow.com/questions/43476801/use-linux-setcap-command-to-set-capabilities-during-yocto-build
Comment 5 Scott Rifenbark 2017-04-18 16:10:18 UTC
Hi Sherif, 

These package dependencies are varied and specific to all sorts of distros and on what a person is trying to do.  I am probably not the appropriate person to assign to this bug.  I don't figure these things out... I document the results after someone else figures out the problem/solution with the system and the circumstances.  

I will CC some people here on the bug but cannot dig into a solution.  Sorry I can't be of more immediate help on this. 

Scott