public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH 0/2] License class fixes
@ 2014-12-22 23:30 Aníbal Limón
  2014-12-22 23:30 ` [PATCH 1/2] license_class: fix license.manifest shows LICENSE field differently to recipe Aníbal Limón
  2014-12-22 23:30 ` [PATCH 2/2] license: Validate if LICENSE is well defined Aníbal Limón
  0 siblings, 2 replies; 3+ messages in thread
From: Aníbal Limón @ 2014-12-22 23:30 UTC (permalink / raw)
  To: openembedded-core

The next couple of patches fixes next issues,

[YOCTO #6757] license.manifest shows LICENSE field differently to recipe 
[YOCTO #6758] Show warning/error if LICENSE field contains space separated entries 

The following changes since commit 15de188692d2572d897799424e2a22eab24c78e2:

  kernel-devsrc: Ensure we have a dependency on the actual source (2014-12-21 13:52:17 +0000)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib alimon/license_fixes
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=alimon/license_fixes

Aníbal Limón (2):
  license_class: fix license.manifest shows LICENSE field differently to
    recipe
  license: Validate if LICENSE is well defined.

 meta/classes/base.bbclass    |  1 +
 meta/classes/license.bbclass | 35 +++++++++++++++++++++++++++++------
 2 files changed, 30 insertions(+), 6 deletions(-)

-- 
1.9.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] license_class: fix license.manifest shows LICENSE field differently to recipe
  2014-12-22 23:30 [PATCH 0/2] License class fixes Aníbal Limón
@ 2014-12-22 23:30 ` Aníbal Limón
  2014-12-22 23:30 ` [PATCH 2/2] license: Validate if LICENSE is well defined Aníbal Limón
  1 sibling, 0 replies; 3+ messages in thread
From: Aníbal Limón @ 2014-12-22 23:30 UTC (permalink / raw)
  To: openembedded-core

Drop removal of [|&()*] operators in pkged_lic because this removal is only
needed to validate if license is collected.

[YOCTO #6757]

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 meta/classes/license.bbclass | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index ea4c880..c55ee77 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -49,24 +49,25 @@ license_create_manifest() {
 
 		pkged_pv="$(sed -n 's/^PV: //p' ${filename})"
 		pkged_name="$(basename $(readlink ${filename}))"
-		pkged_lic="$(sed -n "/^LICENSE_${pkged_name}: /{ s/^LICENSE_${pkged_name}: //; s/[|&()*]/ /g; s/  */ /g; p }" ${filename})"
+		pkged_lic="$(sed -n "/^LICENSE_${pkged_name}: /{ s/^LICENSE_${pkged_name}: //; p }" ${filename})"
 		if [ -z ${pkged_lic} ]; then
 			# fallback checking value of LICENSE
-			pkged_lic="$(sed -n "/^LICENSE: /{ s/^LICENSE: //; s/[|&()*]/ /g; s/  */ /g; p }" ${filename})"
+			pkged_lic="$(sed -n "/^LICENSE: /{ s/^LICENSE: //; p }" ${filename})"
 		fi
 
 		echo "PACKAGE NAME:" ${pkg} >> ${LICENSE_MANIFEST}
 		echo "PACKAGE VERSION:" ${pkged_pv} >> ${LICENSE_MANIFEST}
 		echo "RECIPE NAME:" ${pkged_pn} >> ${LICENSE_MANIFEST}
-		printf "LICENSE:" >> ${LICENSE_MANIFEST}
-		for lic in ${pkged_lic}; do
+		echo "LICENSE:" ${pkged_lic} >> ${LICENSE_MANIFEST}
+		echo "" >> ${LICENSE_MANIFEST}
+
+		lics="$(echo ${pkged_lic} | sed "s/[|&()*]/ /g" | sed "s/  */ /g" )"
+		for lic in ${lics}; do
 			# to reference a license file trim trailing + symbol
 			if ! [ -e "${LICENSE_DIRECTORY}/${pkged_pn}/generic_${lic%+}" ]; then
 				bbwarn "The license listed ${lic} was not in the licenses collected for ${pkged_pn}"
 			fi
-                        printf " ${lic}" >> ${LICENSE_MANIFEST}
 		done
-		printf "\n\n" >> ${LICENSE_MANIFEST}
 	done
 
 	# Two options here:
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] license: Validate if LICENSE is well defined.
  2014-12-22 23:30 [PATCH 0/2] License class fixes Aníbal Limón
  2014-12-22 23:30 ` [PATCH 1/2] license_class: fix license.manifest shows LICENSE field differently to recipe Aníbal Limón
@ 2014-12-22 23:30 ` Aníbal Limón
  1 sibling, 0 replies; 3+ messages in thread
From: Aníbal Limón @ 2014-12-22 23:30 UTC (permalink / raw)
  To: openembedded-core

Add check_license_format function that shows warning if LICENSE don't have
valid operators and also if have space separated entries without operator,
add check_license_format validation into base class.

[YOCTO #6758]

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
---
 meta/classes/base.bbclass    |  1 +
 meta/classes/license.bbclass | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 06cfe26..b8f61f3 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -390,6 +390,7 @@ python () {
         bb.fatal('This recipe does not have the LICENSE field set (%s)' % pn)
 
     if bb.data.inherits_class('license', d):
+        check_license_format(d)
         unmatched_license_flag = check_license_flags(d)
         if unmatched_license_flag:
             bb.debug(1, "Skipping %s because it has a restricted license not"
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index c55ee77..f85d4f9 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -409,6 +409,28 @@ def check_license_flags(d):
             return unmatched_flag
     return None
 
+def check_license_format(d):
+    """
+    This function checks if LICENSE is well defined,
+        Validate operators in LICENSES.
+        No spaces are allowed between LICENSES.
+    """
+    pn = d.getVar('PN', True)
+    licenses = d.getVar('LICENSE', True)
+    from oe.license import license_operator
+    from oe.license import license_pattern
+
+    elements = filter(lambda x: x.strip(), license_operator.split(licenses))
+    for pos, element in enumerate(elements):
+        if license_pattern.match(element):
+            if pos > 0 and license_pattern.match(elements[pos - 1]):
+                bb.warn("Recipe %s, LICENSE (%s) has invalid format, " \
+                        "LICENSES must have operator \"%s\" between them." %
+                        (pn, licenses, license_operator.pattern))
+        elif not license_operator.match(element):
+            bb.warn("Recipe %s, LICENSE (%s) has invalid operator (%s) not in" \
+                  " \"%s\"." % (pn, licenses, element, license_operator.pattern))
+
 SSTATETASKS += "do_populate_lic"
 do_populate_lic[sstate-inputdirs] = "${LICSSTATEDIR}"
 do_populate_lic[sstate-outputdirs] = "${LICENSE_DIRECTORY}/"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-22 23:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-22 23:30 [PATCH 0/2] License class fixes Aníbal Limón
2014-12-22 23:30 ` [PATCH 1/2] license_class: fix license.manifest shows LICENSE field differently to recipe Aníbal Limón
2014-12-22 23:30 ` [PATCH 2/2] license: Validate if LICENSE is well defined Aníbal Limón

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox