ret_prop = {}
def retrieve_license(src_root):
- sdk_license = ''
- license_file = os.path.join(src_root, 'LICENSE')
- if os.path.isfile(license_file):
- shutil.copy(license_file, os.path.dirname(src_root))
- with open(license_file, 'r') as r_file:
- for x in r_file.readlines():
- matchline = re.search(r'.*Licensed under the (.*) License, Version (.*) \(the \"License\"\).*;', x)
- if matchline:
- sdk_license = '%s-%s' % (matchline.groups()[0], matchline.groups()[1])
- print 'SDK_LICENSE: [%s]' % sdk_license
+ sdk_license = None
+ for f in os.listdir(src_root):
+ if os.path.isfile(os.path.join(src_root, f)) and f.startswith('LICENSE'):
+ with open(os.path.join(src_root, f), 'r') as r_file:
+ for x in r_file.readlines():
+ matchline = re.search(r'.*Licensed under the (.*) License, Version (.*) \(the \"License\"\).*;', x)
+ if matchline:
+ sdk_license = '%s-%s' % (matchline.groups()[0], matchline.groups()[1])
+ print 'LICENSE %s from %s' % (sdk_license, f)
return sdk_license
def retrieve_properties_from_project_def(src_root):
ret_prop['sdk_license'] = retrieve_license(src_git.path)
for r in ret_prop:
- print ' [%s]: %s' % (r, ret_prop[r].rstrip())
+ if ret_prop[r]:
+ print ' [%s]: %s' % (r, ret_prop[r].rstrip())
+ else:
+ print ' [%s]: %s' % (r, ret_prop[r])
return ret_prop
def fetch_source(gerrit_env, src_root, project, branch=None, tag=None, patchset=False, \
# SPEC configuration
group = ''
- license = prop.get('license')
+ sdk_license = prop.get('sdk_license')
summary = ''
if os.path.isdir(os.path.join(src_git.path, 'packaging')):
for filename in os.listdir(os.path.join(src_git.path, 'packaging')):
if license == '' or license is None: license = 'N/A'
if summary == '' or summary is None: summary = data.get('obs_package').replace('org.tizen.', '')
+ if sdk_license is not None and sdk_license != '':
+ license = sdk_license
+
vcs = '#VCS_FROM: %s' % (data.get('project') + "#" + prop.get('commit_id'))
vcs_desc = vcs.split(' ')[-1]
mailer.add_message('Result: FAIL')
mailer.add_message('\n\n%s' % project_properties.get('ret_error'))
return 1
+ if 'sdk_license' not in project_properties or project_properties.get('sdk_license') is None:
+ print 'No LICENSE provided.'
+ if data.get('buildcheck', None) == None:
+ mailer.add_title('No LICENSE file')
+ mailer.add_message('Result: FAIL')
+ mailer.add_message('\n\n%s' % 'No LICENSE provided.')
+ return 1
# Make tarball to share source codes easily with vm machine
zipping_workspace(src_root)