From: Gui Chen Date: Thu, 29 Nov 2012 06:21:48 +0000 (+0800) Subject: sync time and zone setting to bootstrap env X-Git-Tag: 0.15~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=63fc50d8b86ce26b91827b5f706ebb1a2b6919fd;p=platform%2Fupstream%2Fmic.git sync time and zone setting to bootstrap env Signed-off-by: Gui Chen --- diff --git a/mic/bootstrap.py b/mic/bootstrap.py index 7f34f19..6f00d66 100644 --- a/mic/bootstrap.py +++ b/mic/bootstrap.py @@ -230,6 +230,15 @@ class Bootstrap(object): os.chroot(rootdir) os.chdir(chdir) + def sync_timesetting(rootdir): + try: + # sync time and zone info to bootstrap + if os.path.exists(rootdir + "/etc/localtime"): + os.unlink(rootdir + "/etc/localtime") + shutil.copyfile("/etc/localtime", rootdir + "/etc/localtime") + except: + pass + if not rootdir: rootdir = self.rootdir @@ -246,6 +255,7 @@ class Bootstrap(object): try: proxy.set_proxy_environ() gloablmounts = setup_chrootenv(rootdir, bindmounts, False) + sync_timesetting(rootdir) retcode = subprocess.call(cmd, preexec_fn=mychroot, env=env, shell=shell) except (OSError, IOError), err: raise RuntimeError(err) diff --git a/mic/msger.py b/mic/msger.py index 03de73b..2252786 100644 --- a/mic/msger.py +++ b/mic/msger.py @@ -87,7 +87,7 @@ def _general_print(head, color, msg = None, stream = None, level = 'normal'): # append normal msg to LOG save_msg = msg.strip() if msg else None if save_msg: - timestr = time.strftime("[%m/%d %H:%M:%S] ", time.localtime()) + timestr = time.strftime("[%m/%d %H:%M:%S %Z] ", time.localtime()) LOG_CONTENT += timestr + save_msg + '\n' if errormsg: