Bug 2473

Summary: Create or modify class for license filtered source archival using archiver.bbclass
Product: [Build System, Metadata & Runtime] Other YP Layers Reporter: Christopher Larson <kergoth>
Component: layersAssignee: Xiaofeng Yan <Xiaofeng.yan>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: Low CC: kai.kang, liang.li2, liezhi.yang, meta.layer.watcher, meta.watcher, song.liu, zhenfeng.zhao
Version: unspecified   
Target Milestone: 1.3 M2   
Hardware: x86   
OS: Multiple   
Whiteboard: (QA testing completed) Done
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---

Description Christopher Larson 2012-05-18 15:27:44 UTC
The current copyleft_compliance class does this, but doesn't leverage the new shared archiver.bbclass functionality. We should consider adapting it to do so, or creating another archive- class to do so. The oe.license python module does most of the work for this, so it would likely be a fairly small effort, but would reduce some duplication.
Comment 1 Xiaofeng Yan 2012-05-23 01:44:18 UTC
Hi Christopher Larson,

Thanks your suggestion. I will learn these class and apply them in archiver.bbclass.

Thanks
Yan
Comment 3 liang li 2012-06-25 03:56:55 UTC
add following to conf/local.conf:

INHERIT += "archive-original-source"
SOURCE_ARCHIVE_PACKAGE_TYPE ?= 'srpm' 
SOURCE_ARCHIVE_LOG_WITH_SCRIPTS ?= 'logs_with_scripts'
run "bitbake core-image-sato",no error happend during build process.

git info: e0a70547069fe7e8a2d6bdaffc985fb172d46c31
git branch: poky/master

test env:
host:ubuntu 12.04 x86_64
linux kernel:3.2.0-25-generic #40-Ubuntu SMP
Comment 4 Christopher Larson 2012-06-25 04:05:59 UTC
This is not done. You've misunderstood what the bug requested. copyleft_compliance allows you to specify, by license, which recipes should and which should not get their sources distributed. As far as I know, archiver.bbclass still does not provide this filtering mechanism.
Comment 5 Christopher Larson 2012-06-25 04:08:02 UTC
(In reply to comment #4)
> This is not done. You've misunderstood what the bug requested.
> copyleft_compliance allows you to specify, by license, which recipes should
> and which should not get their sources distributed. As far as I know,
> archiver.bbclass still does not provide this filtering mechanism.

Further, is_included is being misused. This function is used to determine whether a license matches inclusion/exclusion patterns. It is *not* a function to get a list of all licenses used by a recipe.
Comment 6 Xiaofeng Yan 2012-06-25 09:06:55 UTC
sorry to misunderstand your idea. According to your idea we should add an option for archiver.bbclass usage. 

ARCHIVER_MODE ?= "original"
ARCHIVER_MODE[type] ?= "tar"
ARCHIVER_MODE[log_type] ?= "logs_with_scripts"
ARCHIVER_MODE[filter] = "no"  # we should add this. Do you agree with me ?
ARCHIVER_CLASS = "${@'archive-${ARCHIVER_MODE}-source' if ARCHIVER_MODE != 'none' else ''}"
INHERIT += "${ARCHIVER_CLASS}" 


Please review comment with "#".  "no" represent using original mehod. "yes" represent using filter mode.
Comment 7 Xiaofeng Yan 2012-06-25 11:02:50 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > This is not done. You've misunderstood what the bug requested.
> > copyleft_compliance allows you to specify, by license, which recipes should
> > and which should not get their sources distributed. As far as I know,
> > archiver.bbclass still does not provide this filtering mechanism.
> 
> Further, is_included is being misused. This function is used to determine
> whether a license matches inclusion/exclusion patterns. It is *not* a
> function to get a list of all licenses used by a recipe.

 is_included(licensestr, whitelist=None, blacklist=None)

is_included can return right result in the status of default set.
Comment 8 Kai Kang 2012-06-29 02:08:17 UTC
Yocto commit c3d8b100a2d98770aa977555f11dc70de0a2e1d4
Comment 9 liang li 2012-07-05 10:20:55 UTC
(In reply to comment #8)
> Yocto commit c3d8b100a2d98770aa977555f11dc70de0a2e1d4

I tried adding the two configurations separately to conf/local.conf as below:
---------------------------
CONF_VERSION = "1"
ARCHIVER_MODE ?= "original"
ARCHIVER_MODE[type] ?= "tar"
ARCHIVER_MODE[log_type] ?= "logs_with_scripts"
ARCHIVER_CLASS = "${@'archive-${ARCHIVER_MODE}-source' if ARCHIVER_MODE != 'none' else ''}"
INHERIT += "${ARCHIVER_CLASS}"
---------------------------
and 
---------------------------
CONF_VERSION = "1"
ARCHIVER_MODE ?= "original"
ARCHIVER_MODE[type] ?= "tar"
ARCHIVER_MODE[log_type] ?= "logs_with_scripts"
ARCHIVER_MODE[filter] = "yes"
ARCHIVER_CLASS = "${@'archive-${ARCHIVER_MODE}-source' if ARCHIVER_MODE != 'none' else ''}"
INHERIT += "${ARCHIVER_CLASS}"
----------------------------

then run "bitbake core-image-minimal" ,no error happend during build process.

using the first configurations, following are found in "tmp/deploy/sources" dir:
[yocto@yocto-linux powerpc-poky-linux]$ pwd
/buildarea/tester/build_23/tmp/deploy/sources/powerpc-poky-linux
[yocto@yocto-linux powerpc-poky-linux]$ ls
BSD-3-Clause         GPL-3.0-with-GCC-exceptionGPL-3.0  LGPLv2+BSDPD
GPL-1.0              GPLv2+                             MIT
GPL-2.0              GPLv2.0+LGPLv2.1+                  PD
GPL-2.0BSD-4-Clause  GPLv3+                             Sleepycat
GPL-2.0+LGPL-2.1+    GPLv3+LGPL-2.1+                    Zlib
GPL-2.0LGPL-2.1      LGPLv2.1+
GPL-3.0              LGPLv2.1+GPLv2+


using the second configurations, following are found in "tmp/deploy/sources" dir:
[yocto@yocto-linux powerpc-poky-linux]$ pwd
/buildarea/tester/build_21/tmp/deploy/sources/powerpc-poky-linux
[yocto@yocto-linux powerpc-poky-linux]$ ls
GPL-2.0  GPL-3.0
[yocto@yocto-linux powerpc-poky-linux]$

--------------------------
verified info:
git info: 3051f3644496ab570f3c6fb8f5def9d5843b1508
git branch: poky/master

test env:
host:Fedora 17 x86_64
linux kernel:3.4.3-1.fc17.x86_64 #1 SMP