def build(self, client,<EOL>nobuild=False,<EOL>usecache=True,<EOL>pull=False):
if not nobuild:<EOL><INDENT>self.update_source_images(client,<EOL>usecache=usecache,<EOL>pull=pull)<EOL><DEDENT>width = utils.get_console_width()<EOL>cprint('<STR_LIT:\n>' + '<STR_LIT:=>'*width,<EOL>color='<STR_LIT>', attrs=['<STR_LIT>'])<EOL>line = '<STR_LIT>' % (<EOL>self.targetname, self.imagename, self.steps[-<NUM_LIT:1>].sourcefile)<EOL>cprint(_centered(line, width), color='<STR_LIT>', attrs=['<STR_LIT>'])<EOL>for istep, step in enumerate(self.steps):<EOL><INDENT>print(colored('<STR_LIT>','<STR_LIT>'),<EOL>colored('<STR_LIT>' % (istep+<NUM_LIT:1>, len(self.steps)), '<STR_LIT>', attrs=['<STR_LIT>']),<EOL>colored('<STR_LIT>', color='<STR_LIT>'),<EOL>colored(self.imagename, color='<STR_LIT>', attrs=['<STR_LIT>']))<EOL>if not nobuild:<EOL><INDENT>if step.bust_cache:<EOL><INDENT>stackkey = self._get_stack_key(istep)<EOL>if stackkey in _rebuilt:<EOL><INDENT>step.bust_cache = False<EOL><DEDENT><DEDENT>step.build(client, usecache=usecache)<EOL>print(colored("<STR_LIT>", '<STR_LIT>'),<EOL>colored(step.buildname, '<STR_LIT>', attrs=['<STR_LIT>']),<EOL>end='<STR_LIT>')<EOL>if step.bust_cache:<EOL><INDENT>_rebuilt.add(stackkey)<EOL><DEDENT><DEDENT><DEDENT>finalimage = step.buildname<EOL>if not nobuild:<EOL><INDENT>self.finalizenames(client, finalimage)<EOL>line = '<STR_LIT>'%(<EOL>self.targetname, self.imagename, self.steps[-<NUM_LIT:1>].sourcefile)<EOL>cprint(_centered(line, width),<EOL>color='<STR_LIT>', attrs=['<STR_LIT>'])<EOL>cprint('<STR_LIT:=>' * width, color='<STR_LIT>', attrs=['<STR_LIT>'], end='<STR_LIT>')<EOL><DEDENT>
Drives the build of the final image - get the list of steps and execute them.

Args:
    client (docker.Client): docker client object that will build the image
    nobuild (bool): just create dockerfiles, don't actually build the image
    usecache (bool): use docker cache, or rebuild everything from scratch?
    pull (bool): try to pull new versions of repository images?