From da1fed0a8f71d8190cf4bb0094f58f9c2a12b317 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 29 Mar 2010 16:59:13 +1100 Subject: build: nicer progress display for a standard build --- buildtools/wafsamba/samba_errtable.py | 4 +-- buildtools/wafsamba/samba_pidl.py | 2 +- buildtools/wafsamba/wafsamba.py | 48 +++++++++++++++++++++++++---------- 3 files changed, 37 insertions(+), 17 deletions(-) diff --git a/buildtools/wafsamba/samba_errtable.py b/buildtools/wafsamba/samba_errtable.py index 8f0980220f..b8c60316b3 100644 --- a/buildtools/wafsamba/samba_errtable.py +++ b/buildtools/wafsamba/samba_errtable.py @@ -16,12 +16,12 @@ def SAMBA_ERRTABLE(bld, name, source): out_files.append('%s.c' % bname) out_files.append('%s.h' % bname) - t = bld(rule='${SRC[0].abspath(env)} . ${TGT[0].parent.abspath(env)} default/source4/heimdal_build/compile_et ${SRC[2].abspath(env)} ${TGT[0].bldpath(env)}', + t = bld(rule='${SRC[1].abspath(env)} . ${TGT[0].parent.abspath(env)} default/source4/heimdal_build/compile_et ${SRC[0].abspath(env)} ${TGT[0].bldpath(env)}', ext_out = '.c', before = 'cc', on_results = True, shell = True, - source = ['et_compile_wrapper.sh', 'compile_et', source], + source = [source, 'et_compile_wrapper.sh', 'compile_et'], target = out_files, name = name) Build.BuildContext.SAMBA_ERRTABLE = SAMBA_ERRTABLE diff --git a/buildtools/wafsamba/samba_pidl.py b/buildtools/wafsamba/samba_pidl.py index 1c5e1b0aa6..132d0cf6d5 100644 --- a/buildtools/wafsamba/samba_pidl.py +++ b/buildtools/wafsamba/samba_pidl.py @@ -56,7 +56,7 @@ def SAMBA_PIDL(bld, pname, source, pidl_src_nodes = bld.pidl_files_cache # the cd .. is needed because pidl currently is sensitive to the directory it is run in - t = bld(rule='cd .. && ${PIDL} ${OPTIONS} --outputdir ${OUTPUTDIR} -- ${SRC[0].abspath(env)}', + t = bld(rule='cd .. && ${PIDL} --quiet ${OPTIONS} --outputdir ${OUTPUTDIR} -- ${SRC[0].abspath(env)}', ext_out = '.c', before = 'cc', on_results = True, diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py index 1ab583fcc9..826760c02e 100644 --- a/buildtools/wafsamba/wafsamba.py +++ b/buildtools/wafsamba/wafsamba.py @@ -1,7 +1,7 @@ # a waf tool to add autoconf-like macros to the configure section # and for SAMBA_ macros for building libraries, binaries etc -import Build, os, Options, Task, Utils, cc, TaskGen, fnmatch, re, shutil +import Build, os, Options, Task, Utils, cc, TaskGen, fnmatch, re, shutil, Logs from Configure import conf from Logs import debug from samba_utils import SUBST_VARS_RECURSIVE @@ -777,22 +777,42 @@ def PKG_CONFIG_FILES(bld, pc_files, vnum=None): Build.BuildContext.PKG_CONFIG_FILES = PKG_CONFIG_FILES -# override the display of the compilation and linking messages -def build_progress(self): - return "[%d/%d]" % (self.position[0], self.position[1]) -def cc_display(self): - if Options.options.progress_bar != 0: - return Task.Task.display(self) - fname = self.inputs[0].bldpath(self.env) - if fname[0:3] == '../': - fname = fname[3:] - return "%s Compiling %s\n" % (build_progress(self), fname) -Task.TaskBase.classes['cc'].display = cc_display +############################################################# +# give a nicer display when building different types of files +def progress_display(self, msg, fname): + col1 = Logs.colors(self.color) + col2 = Logs.colors.NORMAL + total = self.position[1] + n = len(str(total)) + fs = '[%%%dd/%%%dd] %s %%s%%s%%s\n' % (n, n, msg) + return fs % (self.position[0], self.position[1], col1, fname, col2) def link_display(self): if Options.options.progress_bar != 0: - return Task.Task.display(self) + return Task.Task.old_display(self) fname = self.outputs[0].bldpath(self.env) - return "%s Linking %s\n" % (build_progress(self), fname) + return progress_display(self, 'Linking', fname) Task.TaskBase.classes['cc_link'].display = link_display + +def samba_display(self): + if Options.options.progress_bar != 0: + return Task.Task.old_display(self) + fname = self.inputs[0].bldpath(self.env) + if fname[0:3] == '../': + fname = fname[3:] + ext_loc = fname.rfind('.') + if ext_loc == -1: + return Task.Task.old_display(self) + ext = fname[ext_loc:] + + ext_map = { '.idl' : 'Compiling IDL', + '.et' : 'Compiling ERRTABLE', + '.asn1': 'Compiling ASN1', + '.c' : 'Compiling' } + if ext in ext_map: + return progress_display(self, ext_map[ext], fname) + return Task.Task.old_display(self) + +Task.TaskBase.classes['Task'].old_display = Task.TaskBase.classes['Task'].display +Task.TaskBase.classes['Task'].display = samba_display -- cgit