From a550b4d35bdc8e63869c4722554f6a0fc87df8be Mon Sep 17 00:00:00 2001 From: JF Ding Date: Thu, 27 Oct 2011 16:23:03 +0800 Subject: [PATCH] save logfile by default if --release specified --- mic/configmgr.py | 1 + mic/creator.py | 1 + mic/imager/baseimager.py | 19 ++++++++++++------- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/mic/configmgr.py b/mic/configmgr.py index f56e7a6..f6a8e33 100644 --- a/mic/configmgr.py +++ b/mic/configmgr.py @@ -41,6 +41,7 @@ DEFAULT_CREATE = { "repomd": None, "local_pkgs_path": None, "release": None, + "logfile": None, "record_pkgs": [], } diff --git a/mic/creator.py b/mic/creator.py index 78f6dd4..2a01886 100644 --- a/mic/creator.py +++ b/mic/creator.py @@ -115,6 +115,7 @@ class Creator(cmdln.Cmdln): if self.options.logfile: msger.set_interactive(False) msger.set_logfile(self.options.logfile) + self.configmgr.create['logfile'] = self.options.logfile if self.options.config: self.configmgr.reset() diff --git a/mic/imager/baseimager.py b/mic/imager/baseimager.py index ebf99be..5a7fb2b 100644 --- a/mic/imager/baseimager.py +++ b/mic/imager/baseimager.py @@ -69,15 +69,20 @@ class BaseImageCreator(object): self.name = createopts['name'] if createopts['release']: self.name += '-' + createopts['release'] - if os.path.exists(self.destdir) and msger.ask('Image dir: %s already exists, '\ - 'need to delete it?' % self.destdir): - shutil.rmtree(self.destdir, ignore_errors = True) + + # check whether destine dir exist + if os.path.exists(self.destdir): + if msger.ask('Image dir: %s already exists, need to delete it?' % self.destdir): + shutil.rmtree(self.destdir, ignore_errors = True) + + # save log by default for --release + if not createopts['logfile']: + msger.set_interactive(False) + msger.set_logfile(os.path.join(self.destdir, self.name+'.log')) # The directory in which all temporary files will be created.""" self.tmpdir = createopts['tmpdir'] - self.cachedir = createopts['cachedir'] - self.target_arch = createopts['arch'] self._local_pkgs_path = createopts['local_pkgs_path'] @@ -95,8 +100,8 @@ class BaseImageCreator(object): self._dep_checks = ["ls", "bash", "cp", "echo", "modprobe", "passwd"] - #FIXME to be obsolete - self.distro_name = "MeeGo" + #FIXME to be obsolete, make it configurable + self.distro_name = "Tizen" # Output image file names""" self.outimage = [] -- 2.34.1