Commit 37b85f23 authored by Sébastien Luttringer's avatar Sébastien Luttringer
Browse files

move build time into image build function

parent 5d67b16a
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -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,
        dt = 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)
        arrow(u"Build time: %s" % datetime.timedelta(seconds=dt))
        if args.chdir:
            os.chdir(cwd)
+4 −0
Original line number Diff line number Diff line
@@ -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):
        '''