From patchwork Mon Aug 4 10:37:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 376232 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 6C4A6140097 for ; Mon, 4 Aug 2014 20:38:42 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 121FB4B6F8; Mon, 4 Aug 2014 12:38:16 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vjL1A2g632-I; Mon, 4 Aug 2014 12:38:15 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 92C5C4B6FC; Mon, 4 Aug 2014 12:37:39 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A26134B6F2 for ; Mon, 4 Aug 2014 12:37:33 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5WFZMC-qhQn7 for ; Mon, 4 Aug 2014 12:37:30 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ob0-f202.google.com (mail-ob0-f202.google.com [209.85.214.202]) by theia.denx.de (Postfix) with ESMTPS id 933A94B6ED for ; Mon, 4 Aug 2014 12:37:18 +0200 (CEST) Received: by mail-ob0-f202.google.com with SMTP id wp18so1865538obc.5 for ; Mon, 04 Aug 2014 03:37:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cB9nrNOoliTN9obdk8ezYpbCezi2Spmh+8XM6wOCc6A=; b=IQU7/h6wGBLu5EyNIUsbCLF2NWYCWr2VgIo+tcsK2pPid9xDrBPvboyjVmy7tk+XA/ 3wyQ5LGwidWlm8UmV7o99jn8HM7aO/kHlGv/m8dgZKrMvtOH+xUbajBwoln0J40s3Xqf gC/faPTWSyhADd27cEntJazzOcov5ubpy4uv6ksQIWPygT44t/VFfqskMVz39B5SGfBi QC1I1SZXqOavj6+jXR0uTE5568LBJvsFce0R1QVZLoNk42VuheWp+Rm4hSDNhHvLFNYW BkwtzJjsejOGjxGW8Cwis2Apaimc4U/nvFErmIJCi95Yh5gjSPPpE6hABww2aIFAXfsA /jzg== X-Gm-Message-State: ALoCoQkbYfiShIyP2uJHTAINiJngDTBgEZXNUBZlh5Ci+rRgKfG97k8NtWTzno2K5AEuOX8D3roK X-Received: by 10.43.85.201 with SMTP id ap9mr33289400icc.11.1407148636998; Mon, 04 Aug 2014 03:37:16 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id l23si1005467yhg.1.2014.08.04.03.37.16 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Aug 2014 03:37:16 -0700 (PDT) Received: from kaki.bld.corp.google.com (kaki.bld.corp.google.com [172.29.216.32]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id C0E205A4492; Mon, 4 Aug 2014 03:37:16 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 54E8F220E75; Mon, 4 Aug 2014 04:37:16 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Mon, 4 Aug 2014 04:37:00 -0600 Message-Id: <1407148622-27240-7-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.0.0.526.g5318336 In-Reply-To: <1407148622-27240-1-git-send-email-sjg@chromium.org> References: <1407148622-27240-1-git-send-email-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH v3 6/8] buildman: Refactor output options X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de We need the output options to be available in several places. It's a pain to pass them into each function. Make them properties of the builder and add a single function to set them up. At the same time, add a function which produces summary output using these options. Signed-off-by: Simon Glass --- Changes in v3: - Add new patch to refactor output options Changes in v2: None tools/buildman/builder.py | 46 +++++++++++++++++++++++++++------------------- tools/buildman/control.py | 8 ++++---- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index 22bcda9..b7f82e2 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -234,6 +234,20 @@ class Builder: for t in self.threads: del t + def SetDisplayOptions(self, show_errors, show_sizes, show_detail, + show_bloat): + """Setup display options for the builder. + + show_errors: True to show summarised error/warning info + show_sizes: Show size deltas + show_detail: Show detail for each board + show_bloat: Show detail for each function + """ + self._show_errors = show_errors + self._show_sizes = show_sizes + self._show_detail = show_detail + self._show_bloat = show_bloat + def _AddTimestamp(self): """Add a new timestamp to the list and record the build period. @@ -890,9 +904,18 @@ class Builder: print "Boards not built (%d): %s" % (len(not_built), ', '.join(not_built)) + def ProduceResultSummary(self, commit_upto, commits, board_selected): + board_dict, err_lines = self.GetResultSummary(board_selected, + commit_upto, read_func_sizes=self._show_bloat) + if commits: + msg = '%02d: %s' % (commit_upto + 1, + commits[commit_upto].subject) + print self.col.Color(self.col.BLUE, msg) + self.PrintResultSummary(board_selected, board_dict, + err_lines if self._show_errors else [], + self._show_sizes, self._show_detail, self._show_bloat) - def ShowSummary(self, commits, board_selected, show_errors, show_sizes, - show_detail, show_bloat): + def ShowSummary(self, commits, board_selected): """Show a build summary for U-Boot for a given board list. Reset the result summary, then repeatedly call GetResultSummary on @@ -901,27 +924,13 @@ class Builder: Args: commit: Commit objects to summarise board_selected: Dict containing boards to summarise - show_errors: Show errors that occured - show_sizes: Show size deltas - show_detail: Show detail for each board - show_bloat: Show detail for each function """ self.commit_count = len(commits) if commits else 1 self.commits = commits self.ResetResultSummary(board_selected) for commit_upto in range(0, self.commit_count, self._step): - board_dict, err_lines = self.GetResultSummary(board_selected, - commit_upto, read_func_sizes=show_bloat) - if commits: - msg = '%02d: %s' % (commit_upto + 1, - commits[commit_upto].subject) - else: - msg = 'current' - print self.col.Color(self.col.BLUE, msg) - self.PrintResultSummary(board_selected, board_dict, - err_lines if show_errors else [], show_sizes, show_detail, - show_bloat) + self.ProduceResultSummary(commit_upto, commits, board_selected) def SetupBuild(self, board_selected, commits): @@ -1031,14 +1040,13 @@ class Builder: if dirname not in dir_list: shutil.rmtree(dirname) - def BuildBoards(self, commits, board_selected, show_errors, keep_outputs): + def BuildBoards(self, commits, board_selected, keep_outputs): """Build all commits for a list of boards Args: commits: List of commits to be build, each a Commit object boards_selected: Dict of selected boards, key is target name, value is Board object - show_errors: True to show summarised error/warning info keep_outputs: True to save build output files """ self.commit_count = len(commits) if commits else 1 diff --git a/tools/buildman/control.py b/tools/buildman/control.py index 12a9699..d8fa74b 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -207,13 +207,13 @@ def DoBuildman(options, args): print GetActionSummary(options.summary, commits, board_selected, options) + builder.SetDisplayOptions(options.show_errors, options.show_sizes, + options.show_detail, options.show_bloat) if options.summary: # We can't show function sizes without board details at present if options.show_bloat: options.show_detail = True - builder.ShowSummary(commits, board_selected, - options.show_errors, options.show_sizes, - options.show_detail, options.show_bloat) + builder.ShowSummary(commits, board_selected) else: builder.BuildBoards(commits, board_selected, - options.show_errors, options.keep_outputs) + options.keep_outputs)