archiver.bbclass: Reduce some duplication for function get_licenses

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]

(From OE-Core rev: 31bee6e7b0a23efc1555ab739ef10041803d5bb1)

Signed-off-by: Xiaofeng Yan <xiaofeng.yan@windriver.com>
Signed-off-by: Elizabeth Flanagan <elizabeth.flanagan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Xiaofeng Yan 2012-06-07 16:37:07 -07:00 committed by Richard Purdie
parent 5be715a6ac
commit 9a519998f4
1 changed files with 12 additions and 11 deletions

View File

@ -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):