* [PATCH 1/1] copyleft_filter.bbclass: Allow to filter on name
[not found] <cover.1433853790.git.mariano.lopez@linux.intel.com>
@ 2015-06-09 12:46 ` mariano.lopez
2015-06-15 15:27 ` Paul Eggleton
2015-06-18 19:26 ` Mariano Lopez
0 siblings, 2 replies; 3+ messages in thread
From: mariano.lopez @ 2015-06-09 12:46 UTC (permalink / raw)
To: openembedded-core
From: Mariano Lopez <mariano.lopez@linux.intel.com>
The archiver uses a license based filter to provide the source code.
This patch allows to search on name based on two new variables (COPYLEFT_PN_INCLUDE,
COPYLEFT_PN_EXCLUDE). Both variables are empty by default.
The filter by name has higher priority than the license filter.
[YOCTO # 6929]
Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
---
meta/classes/archiver.bbclass | 14 ++++++--------
meta/classes/copyleft_filter.bbclass | 25 +++++++++++++++++++++----
2 files changed, 27 insertions(+), 12 deletions(-)
diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
index b598aa3..7b5274d 100644
--- a/meta/classes/archiver.bbclass
+++ b/meta/classes/archiver.bbclass
@@ -52,14 +52,12 @@ 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))
+ 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)
diff --git a/meta/classes/copyleft_filter.bbclass b/meta/classes/copyleft_filter.bbclass
index 2c1d8f1..46be7f7 100644
--- a/meta/classes/copyleft_filter.bbclass
+++ b/meta/classes/copyleft_filter.bbclass
@@ -25,6 +25,14 @@ COPYLEFT_AVAILABLE_RECIPE_TYPES = 'target native nativesdk cross crosssdk cross-
COPYLEFT_AVAILABLE_RECIPE_TYPES[type] = 'list'
COPYLEFT_AVAILABLE_RECIPE_TYPES[doc] = 'Space separated list of available recipe types'
+COPYLEFT_PN_INCLUDE ?= ''
+COPYLEFT_PN_INCLUDE[type] = 'list'
+COPYLEFT_PN_INCLUDE[doc] = 'Space separated list of recipe names to include'
+
+COPYLEFT_PN_EXCLUDE ?= ''
+COPYLEFT_PN_EXCLUDE[type] = 'list'
+COPYLEFT_PN_EXCLUDE[doc] = 'Space separated list of recipe names to exclude'
+
def copyleft_recipe_type(d):
for recipe_type in oe.data.typed_value('COPYLEFT_AVAILABLE_RECIPE_TYPES', d):
if oe.utils.inherits(d, recipe_type):
@@ -39,9 +47,11 @@ def copyleft_should_include(d):
import oe.license
from fnmatch import fnmatchcase as fnmatch
+ included, motive = False, 'recipe did not match anything'
+
recipe_type = d.getVar('COPYLEFT_RECIPE_TYPE', True)
if recipe_type not in oe.data.typed_value('COPYLEFT_RECIPE_TYPES', d):
- return False, 'recipe type "%s" is excluded' % recipe_type
+ include, motive = False, 'recipe type "%s" is excluded' % recipe_type
include = oe.data.typed_value('COPYLEFT_LICENSE_INCLUDE', d)
exclude = oe.data.typed_value('COPYLEFT_LICENSE_EXCLUDE', d)
@@ -53,10 +63,17 @@ def copyleft_should_include(d):
else:
if is_included:
if reason:
- return True, 'recipe has included licenses: %s' % ', '.join(reason)
+ included, motive = True, 'recipe has included licenses: %s' % ', '.join(reason)
else:
- return False, 'recipe does not include a copyleft license'
+ included, motive = False, 'recipe does not include a copyleft license'
else:
- return False, 'recipe has excluded licenses: %s' % ', '.join(reason)
+ included, motive = False, 'recipe has excluded licenses: %s' % ', '.join(reason)
+ if any(fnmatch(d.getVar('PN', True), name) \
+ for name in oe.data.typed_value('COPYLEFT_PN_INCLUDE', d)):
+ included, motive = True, 'recipe included by name'
+ if any(fnmatch(d.getVar('PN', True), name) \
+ for name in oe.data.typed_value('COPYLEFT_PN_EXCLUDE', d)):
+ included, motive = False, 'recipe excluded by name'
+ return included, motive
--
1.8.4.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] copyleft_filter.bbclass: Allow to filter on name
2015-06-09 12:46 ` [PATCH 1/1] copyleft_filter.bbclass: Allow to filter on name mariano.lopez
@ 2015-06-15 15:27 ` Paul Eggleton
2015-06-18 19:26 ` Mariano Lopez
1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggleton @ 2015-06-15 15:27 UTC (permalink / raw)
To: openembedded-core
On Tuesday 09 June 2015 12:46:48 mariano.lopez@linux.intel.com wrote:
> From: Mariano Lopez <mariano.lopez@linux.intel.com>
>
> The archiver uses a license based filter to provide the source code.
> This patch allows to search on name based on two new variables
> (COPYLEFT_PN_INCLUDE, COPYLEFT_PN_EXCLUDE). Both variables are empty by
> default.
> The filter by name has higher priority than the license filter.
>
> [YOCTO # 6929]
>
> Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
> ---
> meta/classes/archiver.bbclass | 14 ++++++--------
> meta/classes/copyleft_filter.bbclass | 25 +++++++++++++++++++++----
> 2 files changed, 27 insertions(+), 12 deletions(-)
>
> diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
> index b598aa3..7b5274d 100644
> --- a/meta/classes/archiver.bbclass
> +++ b/meta/classes/archiver.bbclass
> @@ -52,14 +52,12 @@ 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))
> + 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)
> diff --git a/meta/classes/copyleft_filter.bbclass
> b/meta/classes/copyleft_filter.bbclass index 2c1d8f1..46be7f7 100644
> --- a/meta/classes/copyleft_filter.bbclass
> +++ b/meta/classes/copyleft_filter.bbclass
> @@ -25,6 +25,14 @@ COPYLEFT_AVAILABLE_RECIPE_TYPES = 'target native
> nativesdk cross crosssdk cross- COPYLEFT_AVAILABLE_RECIPE_TYPES[type] =
> 'list'
> COPYLEFT_AVAILABLE_RECIPE_TYPES[doc] = 'Space separated list of available
> recipe types'
>
> +COPYLEFT_PN_INCLUDE ?= ''
> +COPYLEFT_PN_INCLUDE[type] = 'list'
> +COPYLEFT_PN_INCLUDE[doc] = 'Space separated list of recipe names to
> include' +
> +COPYLEFT_PN_EXCLUDE ?= ''
> +COPYLEFT_PN_EXCLUDE[type] = 'list'
> +COPYLEFT_PN_EXCLUDE[doc] = 'Space separated list of recipe names to
> exclude' +
> def copyleft_recipe_type(d):
> for recipe_type in
> oe.data.typed_value('COPYLEFT_AVAILABLE_RECIPE_TYPES', d): if
> oe.utils.inherits(d, recipe_type):
> @@ -39,9 +47,11 @@ def copyleft_should_include(d):
> import oe.license
> from fnmatch import fnmatchcase as fnmatch
>
> + included, motive = False, 'recipe did not match anything'
> +
> recipe_type = d.getVar('COPYLEFT_RECIPE_TYPE', True)
> if recipe_type not in oe.data.typed_value('COPYLEFT_RECIPE_TYPES', d):
> - return False, 'recipe type "%s" is excluded' % recipe_type
> + include, motive = False, 'recipe type "%s" is excluded' %
> recipe_type
>
> include = oe.data.typed_value('COPYLEFT_LICENSE_INCLUDE', d)
> exclude = oe.data.typed_value('COPYLEFT_LICENSE_EXCLUDE', d)
> @@ -53,10 +63,17 @@ def copyleft_should_include(d):
> else:
> if is_included:
> if reason:
> - return True, 'recipe has included licenses: %s' % ',
> '.join(reason) + included, motive = True, 'recipe has
> included licenses: %s' % ', '.join(reason) else:
> - return False, 'recipe does not include a copyleft license'
> + included, motive = False, 'recipe does not include a
> copyleft license' else:
> - return False, 'recipe has excluded licenses: %s' % ',
> '.join(reason) + included, motive = False, 'recipe has excluded
> licenses: %s' % ', '.join(reason)
>
> + if any(fnmatch(d.getVar('PN', True), name) \
> + for name in oe.data.typed_value('COPYLEFT_PN_INCLUDE', d)):
> + included, motive = True, 'recipe included by name'
> + if any(fnmatch(d.getVar('PN', True), name) \
> + for name in oe.data.typed_value('COPYLEFT_PN_EXCLUDE', d)):
> + included, motive = False, 'recipe excluded by name'
>
> + return included, motive
Changes look good.
Acked-by: Paul Eggleton <paul.eggleton@linux.intel.com>
--
Paul Eggleton
Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] copyleft_filter.bbclass: Allow to filter on name
2015-06-09 12:46 ` [PATCH 1/1] copyleft_filter.bbclass: Allow to filter on name mariano.lopez
2015-06-15 15:27 ` Paul Eggleton
@ 2015-06-18 19:26 ` Mariano Lopez
1 sibling, 0 replies; 3+ messages in thread
From: Mariano Lopez @ 2015-06-18 19:26 UTC (permalink / raw)
To: openembedded-core
ping
On 06/09/2015 07:46 AM, mariano.lopez@linux.intel.com wrote:
> From: Mariano Lopez <mariano.lopez@linux.intel.com>
>
> The archiver uses a license based filter to provide the source code.
> This patch allows to search on name based on two new variables (COPYLEFT_PN_INCLUDE,
> COPYLEFT_PN_EXCLUDE). Both variables are empty by default.
> The filter by name has higher priority than the license filter.
>
> [YOCTO # 6929]
>
> Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
> ---
> meta/classes/archiver.bbclass | 14 ++++++--------
> meta/classes/copyleft_filter.bbclass | 25 +++++++++++++++++++++----
> 2 files changed, 27 insertions(+), 12 deletions(-)
>
> diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
> index b598aa3..7b5274d 100644
> --- a/meta/classes/archiver.bbclass
> +++ b/meta/classes/archiver.bbclass
> @@ -52,14 +52,12 @@ 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))
> + 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)
> diff --git a/meta/classes/copyleft_filter.bbclass b/meta/classes/copyleft_filter.bbclass
> index 2c1d8f1..46be7f7 100644
> --- a/meta/classes/copyleft_filter.bbclass
> +++ b/meta/classes/copyleft_filter.bbclass
> @@ -25,6 +25,14 @@ COPYLEFT_AVAILABLE_RECIPE_TYPES = 'target native nativesdk cross crosssdk cross-
> COPYLEFT_AVAILABLE_RECIPE_TYPES[type] = 'list'
> COPYLEFT_AVAILABLE_RECIPE_TYPES[doc] = 'Space separated list of available recipe types'
>
> +COPYLEFT_PN_INCLUDE ?= ''
> +COPYLEFT_PN_INCLUDE[type] = 'list'
> +COPYLEFT_PN_INCLUDE[doc] = 'Space separated list of recipe names to include'
> +
> +COPYLEFT_PN_EXCLUDE ?= ''
> +COPYLEFT_PN_EXCLUDE[type] = 'list'
> +COPYLEFT_PN_EXCLUDE[doc] = 'Space separated list of recipe names to exclude'
> +
> def copyleft_recipe_type(d):
> for recipe_type in oe.data.typed_value('COPYLEFT_AVAILABLE_RECIPE_TYPES', d):
> if oe.utils.inherits(d, recipe_type):
> @@ -39,9 +47,11 @@ def copyleft_should_include(d):
> import oe.license
> from fnmatch import fnmatchcase as fnmatch
>
> + included, motive = False, 'recipe did not match anything'
> +
> recipe_type = d.getVar('COPYLEFT_RECIPE_TYPE', True)
> if recipe_type not in oe.data.typed_value('COPYLEFT_RECIPE_TYPES', d):
> - return False, 'recipe type "%s" is excluded' % recipe_type
> + include, motive = False, 'recipe type "%s" is excluded' % recipe_type
>
> include = oe.data.typed_value('COPYLEFT_LICENSE_INCLUDE', d)
> exclude = oe.data.typed_value('COPYLEFT_LICENSE_EXCLUDE', d)
> @@ -53,10 +63,17 @@ def copyleft_should_include(d):
> else:
> if is_included:
> if reason:
> - return True, 'recipe has included licenses: %s' % ', '.join(reason)
> + included, motive = True, 'recipe has included licenses: %s' % ', '.join(reason)
> else:
> - return False, 'recipe does not include a copyleft license'
> + included, motive = False, 'recipe does not include a copyleft license'
> else:
> - return False, 'recipe has excluded licenses: %s' % ', '.join(reason)
> + included, motive = False, 'recipe has excluded licenses: %s' % ', '.join(reason)
>
> + if any(fnmatch(d.getVar('PN', True), name) \
> + for name in oe.data.typed_value('COPYLEFT_PN_INCLUDE', d)):
> + included, motive = True, 'recipe included by name'
> + if any(fnmatch(d.getVar('PN', True), name) \
> + for name in oe.data.typed_value('COPYLEFT_PN_EXCLUDE', d)):
> + included, motive = False, 'recipe excluded by name'
>
> + return included, motive
--
Mariano Lopez
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-06-18 19:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cover.1433853790.git.mariano.lopez@linux.intel.com>
2015-06-09 12:46 ` [PATCH 1/1] copyleft_filter.bbclass: Allow to filter on name mariano.lopez
2015-06-15 15:27 ` Paul Eggleton
2015-06-18 19:26 ` Mariano Lopez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox