'branch': fields.get('branch'), \
'revision': fields.get('revision'), \
'buildcheck': fields.get('full_build', None)}
- _data['profile'] = _data.get('obs_project').split(':')[-1].lower()
- # Set new branch and tag
- if _data.get('branch').endswith('_' + _data.get('profile')):
- _data['new_branch'] = _data.get('branch') + '_tpk'
- else:
- _data['new_branch'] = _data.get('branch') + '_' + _data.get('profile') + '_tpk'
- _data['new_tag'] = _data.get('tag').replace(_data.get('branch'), _data.get('new_branch'))
+ #TODO: Profile will be fetched from tizen-manifest.xml
+ #_data['profile'] = _data.get('obs_project').split(':')[-1].lower()
+ ## Set new branch and tag
+ #if _data.get('branch').endswith('_' + _data.get('profile')):
+ # _data['new_branch'] = _data.get('branch') + '_tpk'
+ #else:
+ # _data['new_branch'] = _data.get('branch') + '_' + _data.get('profile') + '_tpk'
+ #_data['new_tag'] = _data.get('tag').replace(_data.get('branch'), _data.get('new_branch'))
print 'TOUCHED_DATA:'
for f in _data:
def retrieve_properties_from_project_def(src_root):
+ sdk_package = ''
+ sdk_version = ''
+ sdk_profile = ''
+ ret_error = ''
+
+ # As guided, the last is the main app from multi project listup.
+ def_file_list = []
# Single project
- def_file = os.path.join(src_root, 'tizen-manifest.xml')
+ def_file_list.append(os.path.join(src_root, 'tizen-manifest.xml'))
# Multi project
multiproject_list_f = os.path.join(src_root, 'WORKSPACE')
if os.path.isfile(multiproject_list_f):
for x in r_file.readlines():
if os.path.isdir(os.path.join(src_root, x.rstrip())) and \
os.path.isfile(os.path.join(src_root, x.rstrip(), 'tizen-manifest.xml')):
- def_file = os.path.join(src_root, x.rstrip(), 'tizen-manifest.xml')
-
- print 'Property file: %s' % def_file
- if os.path.isfile(def_file):
- root = ElementTree.ElementTree(file=def_file).getroot()
- sdk_package = root.attrib['package']
- sdk_version = root.attrib['version']
- else:
- raise LocalError('Property file [%s] not found!' % def_file)
+ def_file_list.append(os.path.join(src_root, x.rstrip(), 'tizen-manifest.xml'))
+
+ for def_file in def_file_list:
+ print 'Property file: %s' % def_file
+ if os.path.isfile(def_file):
+ try:
+ with open(def_file, 'r') as df:
+ manifest_dump = df.read()
+ xmlstring = re.sub('\\sxmlns="[^"]+"', '', manifest_dump, count=1)
+ _root = ElementTree.fromstring(xmlstring)
+ for child in _root:
+ if child.tag == 'profile':
+ sdk_profile = child.attrib.get('name', sdk_profile)
+ print 'Set SDK_PROFILE:[%s]' % sdk_profile
+ sdk_package = _root.attrib.get('package', sdk_package)
+ sdk_version = _root.attrib.get('version', sdk_version)
+ except Exception as err:
+ continue
+ if not sdk_profile:
+ ret_error += 'ERROR: No "profile" tag in property file(tizen-manifest.xml)'
print 'TIZEN-MANIFEST.XML (%s) (%s)' % (sdk_package, sdk_version)
- return {'sdk_package': sdk_package, 'sdk_version': sdk_version}
+ return {'sdk_package': sdk_package, 'sdk_version': sdk_version, 'sdk_profile': sdk_profile, 'ret_error': ret_error}
def retrieve_commit_id(src_git):
commit_id = src_git.rev_parse('HEAD')
project_properties = retrieve_project_property(src_git, int_tag)
+ #TODO:
+ print project_properties.get('sdk_profile')
+ data['profile'] = project_properties.get('sdk_profile')
+ # Set new branch and tag
+ if data.get('branch').endswith('_' + data.get('profile')):
+ data['new_branch'] = data.get('branch') + '_tpk'
+ else:
+ data['new_branch'] = data.get('branch') + '_' + data.get('profile') + '_tpk'
+ data['new_tag'] = data.get('tag').replace(data.get('branch'), data.get('new_branch'))
+
mailer.add_title(data.get('obs_package'))
mailer.add_title('(' + data.get('branch') + ')')
if data.get('buildcheck', None):
mailer.add_message('Target OBS project: %s' % data.get('obs_project'))
mailer.add_message('SR subject: %s' % project_properties.get('sr_message'), top=True)
+ #TODO:
+ if project_properties.get('ret_error') != '':
+ print 'You got property error:\n%s' % project_properties.get('ret_error')
+ if data.get('buildcheck', None) == None:
+ mailer.add_title('Property file parsing error')
+ mailer.add_message('Result: FAIL')
+ mailer.add_message('\n\n%s' % project_properties.get('ret_error'))
+ return 1
+
# Make tarball to share source codes easily with vm machine
zipping_workspace(src_root)
sys.stdout.flush()
vm_image = ast.literal_eval(os.getenv('ABS_PROJECT_VM_MAP')).get(data.get('obs_project')).split(',')[0]
my_tizen_studio = TizenStudio(vm_image)
+ for x in data:
+ print '[%s] %s' % (x, data[x])
+ sys.stdout.flush()
ret = my_tizen_studio.build_app_source(package=data.get('package'), \
profile=data.get('profile'), \
gitpath=data.get('project'), \