From 4a91e1449b0c869979231b7f4c98e09c7a5d732a Mon Sep 17 00:00:00 2001 From: Robert Yang Date: Mon, 24 Mar 2014 13:39:26 +0800 Subject: archiver.bbclass: make it can filter the license * Filter the license (default: no), the recipe whose license in COPYLEFT_LICENSE_INCLUDE will be included, and in COPYLEFT_LICENSE_EXCLUDE will be excluded. * The user can set the recipe type that would be archived (native, target, and so on), deafult to all. The copyleft_filter.bbclass is come from copyleft_compliance.bbclass, which is used by both copyleft_compliance.bbclass and archiver.bbclass. [YOCTO #5740] (From OE-Core rev: 0e798d5cbcf585535e19633828dc540a282261fc) Signed-off-by: Robert Yang Signed-off-by: Richard Purdie --- meta/classes/archiver.bbclass | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'meta/classes/archiver.bbclass') diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass index 7780c71ade..9aa9335b94 100644 --- a/meta/classes/archiver.bbclass +++ b/meta/classes/archiver.bbclass @@ -12,9 +12,23 @@ # 5) The environment data, similar to 'bitbake -e recipe': # ARCHIVER_MODE[dumpdata] = "1" # 6) The recipe (.bb and .inc): ARCHIVER_MODE[recipe] = "1" +# 7) Whether output the .src.rpm package: +# ARCHIVER_MODE[srpm] = "1" +# 8) Filter the license, the recipe whose license in +# COPYLEFT_LICENSE_INCLUDE will be included, and in +# COPYLEFT_LICENSE_EXCLUDE will be excluded. +# COPYLEFT_LICENSE_INCLUDE = 'GPL* LGPL*' +# COPYLEFT_LICENSE_EXCLUDE = 'CLOSED Proprietary' +# 9) The recipe type that will be archived: +# COPYLEFT_RECIPE_TYPES = 'target' # -# All of the above can be packed into a .src.rpm package: (when PACKAGES != "") -# ARCHIVER_MODE[srpm] = "1" + +# Don't filter the license by default +COPYLEFT_LICENSE_INCLUDE ?= '' +COPYLEFT_LICENSE_EXCLUDE ?= '' +# Create archive for all the recipe types +COPYLEFT_RECIPE_TYPES ?= 'target native nativesdk cross crosssdk cross-canadian' +inherit copyleft_filter ARCHIVER_MODE[srpm] ?= "0" ARCHIVER_MODE[src] ?= "patched" @@ -38,6 +52,15 @@ do_ar_original[dirs] = "${ARCHIVER_OUTDIR} ${ARCHIVER_WORKDIR}" python () { pn = d.getVar('PN', True) + if d.getVar('COPYLEFT_LICENSE_INCLUDE', True) or \ + d.getVar('COPYLEFT_LICENSE_EXCLUDE', True): + included, reason = copyleft_should_include(d) + if not included: + bb.debug(1, 'archiver: %s is excluded: %s' % (pn, reason)) + return + else: + bb.debug(1, 'archiver: %s is included: %s' % (pn, reason)) + ar_src = d.getVarFlag('ARCHIVER_MODE', 'src', True) ar_dumpdata = d.getVarFlag('ARCHIVER_MODE', 'dumpdata', True) ar_recipe = d.getVarFlag('ARCHIVER_MODE', 'recipe', True) -- cgit v1.2.3-54-g00ecf