Bug 8633

Summary: Add LICENSE_CREATE_PACKAGE to the Variables Glossary
Product: [Documentation] Reference Reporter: Bevenson <bevenson>
Component: handbookAssignee: Paul Eggleton <bluelightning>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: bluelightning, joshuagloe, poky.doc.watcher, poky.watcher, srifenbark
Version: 2.0   
Target Milestone: 2.1   
Hardware: x86   
OS: Multiple   
Whiteboard: 3 Feb 2016: RESOLVED
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Done (doc changes complete)
Bug Depends on:    
Bug Blocks: 8634    

Description Bevenson 2015-11-03 14:43:12 UTC
The variable LICENSE_CREATE_PACKAGE exists, but there is no description of this variable in the documentation.

Add LICENSE_CREATE_PACKAGE to the Variables Glossary.  Describe what this variable does and how to use it.
Comment 1 Scott Rifenbark 2016-01-07 23:12:43 UTC
Hi, 

Can someone give me an explanation of this variable from the user's point of view?  I grepped in poky for the variable and it occurs three times in the license.bbclass file.  It is a BOOLEAN variable that is set to "0".  It is used here:

# it would be better to copy them in do_install_append, but find_license_filesa is python
python perform_packagecopy_prepend () {
    enabled = oe.data.typed_value('LICENSE_CREATE_PACKAGE', d)
    if d.getVar('CLASSOVERRIDE', True) == 'class-target' and enabled:
        lic_files_paths = find_license_files(d)

        # LICENSE_FILES_DIRECTORY starts with '/' so os.path.join cannot be used to join D and LICENSE_FILES_DIRECTORY
        destdir = d.getVar('D', True) + os.path.join(d.getVar('LICENSE_FILES_DIRECTORY', True), d.getVar('PN', True))
        copy_license_files(lic_files_paths, destdir)
        add_package_and_files(d)
}
 
How does this translate to what a user would do with this variable?

Thanks, 
Scott
Comment 2 Stephen K Jolley 2016-01-11 22:57:39 UTC
Paul,

Can you comment on this?

Thanks,

Stephen
Comment 3 Joshua Lock 2016-02-01 10:37:18 UTC
When LICENSE_CREATE_PACKAGE is set, i.e. LICENSE_CREATE_PACKAGE="1", the system will create an extra package for each recipe, ${PN}-lic, and add that package to the RRECOMMENDS_${PN}.

The ${PN}-lic package installs a directory in /usr/share-licenses named ${PN} (the recipe's base name) and installs files in that directory containing license and copyright information — copies of the appropriate license files from meta/common-licenses (matching the licenses specified in the LICENSE field of the recipe metadata) and files marked in LIC_FILES_CHKSUM as containing license text.
Comment 4 Scott Rifenbark 2016-02-03 01:33:15 UTC
Hi, 

Can you look at http://www.yoctoproject.org/docs/2.1/ref-manual/ref-manual.html#var-LICENSE_CREATE_PACKAGE and tell me if this variable description works?  

Thanks, 
Scott
Comment 5 Bevenson 2016-02-03 12:20:48 UTC
I gave it a try per the instructions and I'm seeing some discrepancies.  I added the line LICENSE_CREATE_PACKAGE = "1" to my local.conf and rebuilt my image (bitbake <image-name>, I did not issue a -c clean or -c cleansstate on anything first).  There was one package that needed to be rebuilt anyway, and this was the only package for which a -lic package was created.  If someone is adding this variable for an existing recipe, somewhere should be a description of how to force a build of all the -lic packages for the image.

On my image, the -lic package installed the license files to /usr/share/licenses/${PN}, not /usr/share-licenses/${PN} as in the description.

I'm on poky/dizzy-1.7.3.  I didn't see any changes in license.bbclass between dizzy and master that would affect LICENSE_CREATE_PACKAGE's behaivor, but it would be worth a test with master.
Comment 6 Joshua Lock 2016-02-03 14:48:35 UTC
(In reply to comment #5)
> On my image, the -lic package installed the license files to
> /usr/share/licenses/${PN}, not /usr/share-licenses/${PN} as in the
> description.

Yes, that matches here. Apologies Scott, I typoed in my original description above.
Comment 7 Scott Rifenbark 2016-02-03 15:24:21 UTC
No problem... I fixed the path. See http://www.yoctoproject.org/docs/2.1/ref-manual/ref-manual.html#var-LICENSE_CREATE_PACKAGE.

Regarding how to force the thing to create a license file for all the packages in an image... If you tell me how to do that I can add it to the description.

Scott
Comment 8 Joshua Lock 2016-02-03 15:51:09 UTC
(In reply to comment #5)
> I gave it a try per the instructions and I'm seeing some discrepancies.  I
> added the line LICENSE_CREATE_PACKAGE = "1" to my local.conf and rebuilt my
> image (bitbake <image-name>, I did not issue a -c clean or -c cleansstate on
> anything first).  There was one package that needed to be rebuilt anyway,
> and this was the only package for which a -lic package was created.  If
> someone is adding this variable for an existing recipe, somewhere should be
> a description of how to force a build of all the -lic packages for the image.

This is expected to work, I've re-opened an existing bug to track it: #5635
Comment 9 Scott Rifenbark 2016-02-03 16:04:19 UTC
Josh, 

So can I set the doc flag to "done" for this 8633 bug?
Comment 10 Joshua Lock 2016-02-03 16:40:27 UTC
(In reply to comment #9)
> So can I set the doc flag to "done" for this 8633 bug?

I believe you can mark it resolved. This bug is tracking the docs requirement, #5635 is tracking the bug. The documentation is updated as requested.

https://bugzilla.yoctoproject.org/show_bug.cgi?id=5635
Comment 11 Scott Rifenbark 2016-02-03 16:44:48 UTC
Per Josh... I am marking this RESOLVED and resetting the doc flag to "done".  I know I don't own the bug but it saves Paul from having to do it.

Scott