X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tic%2Fcommand.py;h=51f41ccf791bee713828d6bf654afd0110fcf25b;hb=5da36bf987dc80e028d4d17b7b856fb93ffaf0ca;hp=c2e80c0729467d1179371d64b1dae54626673307;hpb=562daa03496865a47da0a31ffd7d8571f46ad533;p=archive%2F20170607%2Ftools%2Ftic-core.git diff --git a/tic/command.py b/tic/command.py index c2e80c0..51f41cc 100644 --- a/tic/command.py +++ b/tic/command.py @@ -30,6 +30,7 @@ from tic.utils.error import TICError from tic.utils.file import copyfile from tic.repo import get_repodata_from_repos from tic.pykickstarter import KSoption, kswriter +from tic.utils import process DEFAULT_CACHEDIR='/var/tmp/tic-core/cached' @@ -79,10 +80,12 @@ def analyze(repo_list, recipe_list=None): def exports(export_type, recipe, packages, outdir): logger = logging.getLogger(__name__) + + #TODO validation should be checked before request if not export_type: export_type='ks' logger.info('set default export format(.ks)') - + if not recipe: raise TICError('No recipe defined') if not packages or type(packages) is not list: @@ -120,3 +123,19 @@ def exports(export_type, recipe, packages, outdir): logger.info('copy the ks file from %s to dst:%s', kspath, output) return output + +def createimage(recipes, ksfile, outdir): + logger = logging.getLogger(__name__) + + if recipes: + logger.info('the recipes option is not yet supported') + return + + if not os.path.exists(ksfile) or os.path.isdir(ksfile): + raise TICError('kickstart file does not exist') + + mic_command=['mic', 'cr', 'auto', ksfile] + if outdir: + mic_command.append('--outdir=%s' % outdir) + + process.run(mic_command, 2)