[TIC-CORE] support local repository
[archive/20170607/tools/tic-core.git] / tic / parser / recipe_parser.py
index 6ddd176..a830cb3 100644 (file)
@@ -26,6 +26,7 @@ import os
 from tic.utils import error
 from tic.utils.file import write, make_dirs
 import yaml
+from tic.config import configmgr
 
 
 def get_default_recipe():
@@ -77,9 +78,11 @@ def get_default_recipe():
         Repositories=[
             dict(Name='tizen-unified',
                  Url='http://download.tizen.org/live/devel:/Tizen:/Unified/standard/',
+                 #Url='file://home/shinchulwoo/Repo/Unified',
                  Options='--ssl_verify=no'),
             dict(Name='tizen-base',
                  Url='http://download.tizen.org/snapshots/tizen/base/latest/repos/arm/packages/',
+                 #Url='file://home/shinchulwoo/Repo/Base',
                  Options='--ssl_verify=no')
         ],
         Partitions=[
@@ -92,13 +95,16 @@ part /boot/kernel/mod_tizen_tm1/lib/modules --size=12 --ondisk mmcblk0p --fstype
     return recipe
 
 def load_yaml(path):
+    logger = logging.getLogger(__name__)
     try:
         with file(path) as f:
             return yaml.load(f)
-    except IOError:
-        raise error.TICError('cannot read meta file: %s' % path)
-    except:
-        raise error.TICError('yaml format error of meta file: %s' % path)
+    except IOError as err:
+        logger(err)
+        raise error.TICError(configmgr.message['server_error'])
+    except yaml.YAMLError as err:
+        logger(err)
+        raise error.TICError(configmgr.message['recipe_parse_error'] % os.path.basename(path))
     
 
 def convert_recipe_to_yaml(recipe, filepath):