Change rootstrap search option
authorhyokeun <hyokeun.jeon@samsung.com>
Wed, 23 May 2018 05:48:26 +0000 (14:48 +0900)
committerhyokeun <hyokeun.jeon@samsung.com>
Wed, 23 May 2018 05:48:26 +0000 (14:48 +0900)
abs
build.template

diff --git a/abs b/abs
index ea98aa2..f561fe2 100755 (executable)
--- a/abs
+++ b/abs
@@ -139,25 +139,32 @@ class _Rootstrap(object):
     rootstrap_list = None
     sdk_path = None
 
-    def __init__(self, sdk_path=None, config=None):
+    def __init__(self, sdk_path=None, config=None, rootstrap_search=None):
 
         self.tizen = sdk_path
-        self.list_rootstrap()
+        self.list_rootstrap(rootstrap_search)
         self.config_file = config
 
-    def list_rootstrap(self):
+    def list_rootstrap(self, rootstrap_search=None):
         """List all the rootstraps"""
 
+        rs_prefix = 'mobile|wearable'
+        if rootstrap_search is not None:
+            rs_prefix = rootstrap_search
+        print 'Set rs_prefix: %s' % rs_prefix
+
         if self.rootstrap_list != None:
             return self.rootstrap_list
 
         cmdline = self.tizen + ' list rootstrap'
         ret = Executor().run(cmdline, show=False)
         for x in ret.splitlines():
-            if re.search('(mobile|wearable)-(2.4|3.0|4.0|5.0)-(device|emulator|device64|emulator64).core.*', x):
+            if re.search('(%s)-(2.4|3.0|4.0|5.0)-(device|emulator|device64|emulator64).core.*' % rs_prefix, x):
                 if self.rootstrap_list == None:
                     self.rootstrap_list = []
                 self.rootstrap_list.append(x.split(' ')[0])
+            else:
+                print 'No search result for %s' % '(%s)-(2.4|3.0|4.0|5.0)-(device|emulator|device64|emulator64).core.*' % rs_prefix
         return self.rootstrap_list
 
     def check_rootstrap(self, rootstrap, show=True):
@@ -185,7 +192,7 @@ class Sdk(object):
                      'tizen-sdk-ux/tools/ide/bin/tizen', \
                      'tizen-sdk-cli/tools/ide/bin/tizen']
 
-    def __init__(self, sdkpath=None):
+    def __init__(self, sdkpath=None, rootstrap_search=None):
 
         self.error_parser = ErrorParser()
         self.runtool = Executor(checker=self.error_parser)
@@ -208,7 +215,7 @@ class Sdk(object):
             print 'Cannot locate cli tool'
             raise LocalError('Fail to locate cli tool')
 
-        self.rs = _Rootstrap(sdk_path=self.tizen, config=self.config_file)
+        self.rs = _Rootstrap(sdk_path=self.tizen, config=self.config_file, rootstrap_search=rootstrap_search)
 
     def get_user_root(self):
 
@@ -617,6 +624,9 @@ def argument_parsing(argv):
     build.add_argument('--sdkpath', action='store', dest='sdkpath', \
                         help='Specify Tizen SDK installation root (one time init).' \
                              ' ex) /home/yours/tizen-sdk/')
+    build.add_argument('--profile-to-search', action='store', dest='profiletosearch', \
+                        help='Rootstrap profile prefix.' \
+                             ' ex) (mobile|wearable|da-hfp)')
     build.add_argument('--c-opts', action='store', dest='c_opts', \
                         help='Extra compile options USER_C_OPTS')
     build.add_argument('--cpp-opts', action='store', dest='cpp_opts', \
@@ -631,7 +641,10 @@ def build_main(args):
 
     my_source = Source(src=args.workspace)
     my_source.set_user_options(c_opts=args.c_opts, cpp_opts=args.cpp_opts, link_opts=args.link_opts)
-    my_sdk = Sdk(sdkpath=args.sdkpath)
+    print '-------------------'
+    print '(%s)' % args.profiletosearch
+    print '-------------------'
+    my_sdk = Sdk(sdkpath=args.sdkpath, rootstrap_search=args.profiletosearch)
     my_sdk.clean(my_source)
     my_sdk.build_native(my_source, rootstrap=args.rootstrap, arch=args.arch, conf=args.conf, jobs=args.jobs)
     if args.conf == 'Debug' :
index 98fdf69..c94412f 100644 (file)
@@ -56,7 +56,7 @@ for rs in $rs_list; do
   #if [[ $rs == *"64.core"* ]]; then
   #  echo "SKIP! 64-bit not supported!"; continue;
   #else
-    su - build -c "${ABS_CMD} build -r $rs -w ${BUILD_ROOT}/${PACKAGE} -s ABS -c ${BUILD_MODE} ${PARALLEL_JOBS}"
+    su - build -c "${ABS_CMD} build -r $rs -w ${BUILD_ROOT}/${PACKAGE} -s ABS -c ${BUILD_MODE} ${PARALLEL_JOBS} --profile-to-search ${PROFILE}"
   #fi
   mv ${TMP_DIR}/*.tpk ${SHARE_ROOT}
   ret=$?; echo "BUILDING FINISH TIME: `date`"