Separate Web App templates 93/215093/5
authorHyokeun Jeon <hyokeun.jeon@samsung.com>
Tue, 1 Oct 2019 10:33:38 +0000 (19:33 +0900)
committerHyokeun Jeon <hyokeun.jeon@samsung.com>
Wed, 2 Oct 2019 04:56:46 +0000 (13:56 +0900)
Change-Id: I00db9386d7cb2c88cff8c9e01314e733b62d0a9d

abs/job_abs_build.py
common/tizen_studio.py

index fc8bdb3..8398ae0 100755 (executable)
@@ -520,7 +520,7 @@ def generate_spec_file(tizen_studio, src_git, prop, data, app_type):
 
     internal_package_name = prop.get('sdk_package')
     if app_type == 'wgt':
-        internal_package_name = prop.get('sdk_web_name')
+        internal_package_name = '%s' % data.get('obs_package')
 
     for fn in os.listdir(tizen_studio.builddir):
         if app_type == 'tpk':
@@ -531,23 +531,30 @@ def generate_spec_file(tizen_studio, src_git, prop, data, app_type):
                         found_archs.extend(l)
                         break
         elif app_type == 'wgt':
-            full_arch = []
-            for l in archs_lookup:
-                full_arch.extend(l)
-            mtch = re.search(r'(.*)-(%s)(?<!-debug).wgt' % '|'.join(full_arch), fn)
-            if mtch and mtch.groups() and len(mtch.groups()) == 2:
+            if True:
+                mtch = re.search(r'(.*).wgt', fn)
+                if mtch:
+                    _app_version = prop.get('sdk_version')
+                    os.rename(os.path.join(tizen_studio.builddir, fn), \
+                              os.path.join(tizen_studio.builddir, "%s-%s.wgt" % (internal_package_name, _app_version)))
+            else:
+                full_arch = []
                 for l in archs_lookup:
-                    _a = mtch.groups()[1]
-                    if _a in l:
-                        found_archs.extend(l)
-                        _app_name = prop.get('sdk_web_name')
-                        _app_arch = _a
-                        _app_version = prop.get('sdk_version')
-                        #Append version info in filename
-                        os.rename(os.path.join(tizen_studio.builddir, fn), \
-                                  os.path.join(tizen_studio.builddir, "%s-%s-%s.wgt" % (_app_name, _app_version, _app_arch)))
-                                  #fn.replace(_a, '%s-%s' % (prop.get('sdk_version'), _a))))
-                        break
+                    full_arch.extend(l)
+                mtch = re.search(r'(.*)-(%s)(?<!-debug).wgt' % '|'.join(full_arch), fn)
+                if mtch and mtch.groups() and len(mtch.groups()) == 2:
+                    for l in archs_lookup:
+                        _a = mtch.groups()[1]
+                        if _a in l:
+                            found_archs.extend(l)
+                            _app_name = prop.get('sdk_web_name')
+                            _app_arch = _a
+                            _app_version = prop.get('sdk_version')
+                            #Append version info in filename
+                            os.rename(os.path.join(tizen_studio.builddir, fn), \
+                                      os.path.join(tizen_studio.builddir, "%s-%s-%s.wgt" % (_app_name, _app_version, _app_arch)))
+                                      #fn.replace(_a, '%s-%s' % (prop.get('sdk_version'), _a))))
+                            break
 
     found_archs = list(set(found_archs))
     print 'found_archs=%s' % found_archs
@@ -595,7 +602,10 @@ def generate_spec_file(tizen_studio, src_git, prop, data, app_type):
 
     rpm_build_mode = '%{nil}'
 
-    spec_template = tizen_studio.get_template('spec')
+    if app_type == 'wgt':
+        spec_template = tizen_studio.get_template('spec-wgt')
+    else:
+        spec_template = tizen_studio.get_template('spec')
     spec_template = spec_template.replace( \
                         '__OBS_PACKAGE_NAME__', data.get('obs_package')).replace( \
                         '__VCS__', vcs).replace( \
@@ -782,7 +792,10 @@ def start_build(fields):
     mailer.add_receiver(data.get('email'))
     mailer.add_message('Package: %s' % data.get('project'))
     mailing_list = os.getenv('ABS_MAILINGLIST').split(',')
-    mailing_list.extend(ast.literal_eval(os.getenv('ABS_MAILINGLIST_2')).get(data.get('obs_project')).split(','))
+    try:
+        mailing_list.extend(ast.literal_eval(os.getenv('ABS_MAILINGLIST_2')).get(data.get('obs_project')).split(','))
+    except Exception as err:
+        pass
     mailer.add_receiver(filter(None, mailing_list))
 
     non_exist_prjs = [ prj for prj in set([data.get('obs_project')]) if not build.exists(prj) ]
@@ -834,11 +847,11 @@ def start_build(fields):
         print 'Set obs_package to sdk [%s]' % data['obs_package']
 
     #FIXME: 
-    if project_properties.get('sdk_profile') == "" or project_properties.get('sdk_profile') is None:
-        if "mobile" in data.get('project'):
-            project_properties['sdk_profile'] = "mobile"
-        elif "wearable" in data.get('project'):
-            project_properties['sdk_profile'] = "wearable"
+    if project_properties.get('sdk_profile') == "" or project_properties.get('sdk_profile') is None \
+        or project_properties.get('app_type') == 'wgt':
+        profile_search = re.search(r'profile/(.*)/apps/native|web/.*', data.get('project'))
+        if profile_search and profile_search.groups():
+            project_properties['sdk_profile'] = profile_search.groups()[0]
         else:
             project_properties['sdk_profile'] = "mobile"
     print project_properties.get('sdk_profile')
@@ -927,7 +940,8 @@ def start_build(fields):
                                            gitpath=data.get('project'), \
                                            build_mode=os.getenv('BUILD_MODE'), \
                                            parallel_jobs=parallel_jobs, \
-                                           build_type=data.get('type', 'default'))
+                                           build_type=data.get('type', 'default'), \
+                                           app_type=branch_postfix)
     print '[ TizenStudio END ] %s' % (str(datetime.now()))
     print ret
 
index 637bdaf..025b73e 100644 (file)
@@ -238,11 +238,15 @@ class TizenStudio(object):
                 'tizen_studio_version': tizen_studio_version, \
                 'tizen_studio_distribution': tizen_studio_distribution}
 
-    def build_app_source(self, package, profile=None, gitpath=None, build_mode='Release', parallel_jobs='', build_type='default'):
+    def build_app_source(self, package, profile=None, gitpath=None, build_mode='Release', \
+                         parallel_jobs='', build_type='default', app_type='tpk'):
 
         PROFILE = profile
 
-        build_cmd = self.get_template('build')
+        if app_type == 'wgt':
+            build_cmd = self.get_template('build-wgt')
+        else:
+            build_cmd = self.get_template('build')
         build_cmd = build_cmd.replace( \
                      '__SDK_PATH__', self.sdk_path).replace( \
                      '__SHARE_ROOT__', self.share_root).replace( \