Skip to contentSkip to conversation

archiver.bbclass: Reduce some duplication for function get_licenses

PATCH Applied [email protected] 2 participants 3 messages Jun 7, 2012 – Jun 12, 2012

lore
Share & tools
lore
#0 lore raw

cover archiver.bbclass: Reduce some duplication for function get_licenses

From: Xiaofeng Yan <[email protected]>

The content to modify this bbclass is as follow:
- Use the existing functions to get license as a directory instead of rewriting it for avoiding code duplication.
- Use SPDXLICENSEMAP to map licenses

The following changes since commit df8f55a919b3cc602ce1f1c51630c7edf6e36b55:
Cristian Iorga (1):
ltp: Add patch to correct failing build

are available in the git repository at:

git://git.pokylinux.org/poky-contrib xiaofeng/2473
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=xiaofeng/2473

Xiaofeng Yan (1):
archiver.bbclass: Reduce some duplication for function get_licenses

 meta/classes/archiver.bbclass |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)
#1 lore raw

PATCH 1/1 archiver.bbclass: Reduce some duplication for function get_licenses

From: Xiaofeng Yan <[email protected]>

The content to modify this bbclass is as follow:
- Use the existing functions to get license as a directory instead of rewriting it for avoiding code duplication.
- Use SPDXLICENSEMAP to map licenses

[YOCTO #2473]

---
 meta/classes/archiver.bbclass |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)
meta/classes/archiver.bbclass +12 -11
index ed2dbe4..083bb1d 100644
@@ -225,17 +225,18 @@ def archive_logs(d,logdir,bbinc=False):
 
 def get_licenses(d):
 	'''get licenses for running .bb file'''
-	licenses = d.getVar('LICENSE', 1).replace('&', '|')
-	licenses = licenses.replace('(', '').replace(')', '') 
-	clean_licenses = ""
-	for x in licenses.split():
-		if x.strip() == '' or x == 'CLOSED':
-			continue
-		if x != "|":
-			clean_licenses += x
-	if '|' in clean_licenses:
-		clean_licenses = clean_licenses.replace('|','')
-	return clean_licenses
+	import oe.license
+
+	licenses_type = d.getVar('LICENSE', True) or ""
+	lics = oe.license.is_included(licenses_type)[1:][0]
+	lice = ''
+	for lic in lics:
+		licens = d.getVarFlag('SPDXLICENSEMAP', lic)
+		if licens != None:
+			lice += licens
+		else:
+			lice += lic
+	return lice
 	
 
 def move_tarball_deploy(d,tarball_list):
Signature · 1 line
1.7.0.4
Applied
#2 lore raw
In reply to [email protected]
Quoted 19 lines · On 06/06/2012 07:01 PM, [email protected] wrote:

From: Xiaofeng Yan<[email protected]>

The content to modify this bbclass is as follow:
- Use the existing functions to get license as a directory instead of rewriting it for avoiding code duplication.
- Use SPDXLICENSEMAP to map licenses

The following changes since commit df8f55a919b3cc602ce1f1c51630c7edf6e36b55:
Cristian Iorga (1):
ltp: Add patch to correct failing build

are available in the git repository at:

   git://git.pokylinux.org/poky-contrib xiaofeng/2473
   http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=xiaofeng/2473

Xiaofeng Yan (1):
archiver.bbclass: Reduce some duplication for function get_licenses

Quoted 10 lines
  meta/classes/archiver.bbclass |   23 ++++++++++++-----------
  1 files changed, 12 insertions(+), 11 deletions(-)

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Merged into OE-Core

Thanks
Sau!