Commit 37b85f23 authored by Seblu's avatar Seblu

move build time into image build function

parent 5d67b16a
......@@ -21,7 +21,6 @@ InstallSystems Command line Tool
'''
import os
import time
import datetime
import re
import fnmatch
......@@ -127,16 +126,11 @@ def c_build(args):
os.chdir(path)
path = "."
arrowlevel(1)
# build start time
t0 = time.time()
# load source image
simg = SourceImage(path)
# do the job
simg.build(force=args.force, force_payload=args.payload,
check=not args.no_check, script=not args.no_script)
# compute building time
t1 = time.time()
dt = int(t1 - t0)
dt = simg.build(force=args.force, force_payload=args.payload,
check=not args.no_check, script=not args.no_script)
arrow(u"Build time: %s" % datetime.timedelta(seconds=dt))
if args.chdir:
os.chdir(cwd)
......
......@@ -301,6 +301,8 @@ class SourceImage(Image):
# check if free to create script tarball
if os.path.exists(self.image_name) and force == False:
raise ISError("Tarball already exists. Remove it before")
# register start time
t0 = time.time()
# check python scripts
if check:
for d in (self.build_path, self.parser_path, self.setup_path):
......@@ -322,6 +324,8 @@ class SourceImage(Image):
jdesc = self.generate_json_description()
# creating scripts tarball
self.create_image(jdesc)
# compute building time
return int(time.time() - t0)
def create_image(self, jdescription):
'''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment