From patchwork Thu May 19 06:52:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 68092 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp3032737qge; Wed, 18 May 2016 23:53:01 -0700 (PDT) X-Received: by 10.194.23.1 with SMTP id i1mr11607422wjf.142.1463640781304; Wed, 18 May 2016 23:53:01 -0700 (PDT) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id l185si16338860wmf.120.2016.05.18.23.53.01; Wed, 18 May 2016 23:53:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4A11CA765E; Thu, 19 May 2016 08:52:40 +0200 (CEST) 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 6ldn_BMi76B8; Thu, 19 May 2016 08:52:40 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0686EA7662; Thu, 19 May 2016 08:51:56 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8D141A7498 for ; Thu, 19 May 2016 08:51:31 +0200 (CEST) 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 vl964hphqNz9 for ; Thu, 19 May 2016 08:51:31 +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 conuserg-12.nifty.com (conuserg-12.nifty.com [210.131.2.79]) by theia.denx.de (Postfix) with ESMTPS id 480E3A7517 for ; Thu, 19 May 2016 08:51:29 +0200 (CEST) Received: from beagle.diag.org (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-12.nifty.com with ESMTP id u4J6p2Zq001067; Thu, 19 May 2016 15:51:12 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com u4J6p2Zq001067 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1463640673; bh=hB2iOdcm4zPg7Lvvhw1FhiyW3oIjXhedVGFu1PJQnFs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2yuu8D0imL6AH5EbmlMSHhVgQ2zKhIvckiEwI+9uEkygwb+k1b1H7Xm2SwI/NGhDz Bq1fzEKkV4WgBIK3gD4FXhrhjAkYwlQrS+khZIiC1AzECDigPjQOc0VYFbD+nTg7bo gcvv32C+dImHG45ePjpsshOqIL6eo03Nj7SuF3q7kOayFOtwlg2wrSc1nQCmZITyj8 rQAwQ400aVADdF48sreOLOYNdwH4EhMgVaGZA4q56Fjqr89p6Vl96Q2VJjhbhykDPq PTseF4jXcDscySQQz19sqb/QtYmFU5tYhJwb0IuFHanG93k9rcUPf/aAznyXpgqwpd fWbGWnb1GeCbQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Thu, 19 May 2016 15:52:01 +0900 Message-Id: <1463640729-25666-14-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1463640729-25666-1-git-send-email-yamada.masahiro@socionext.com> References: <1463640729-25666-1-git-send-email-yamada.masahiro@socionext.com> Cc: Joe Hershberger Subject: [U-Boot] [PATCH 13/21] tools: moveconfig: move log output code out of Kconfig Parser class X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This will help further improvement/clean-up. Signed-off-by: Masahiro Yamada --- tools/moveconfig.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) -- 1.9.1 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 9f38a08..96ada0d 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -416,18 +416,16 @@ class KconfigParser: re_arch = re.compile(r'CONFIG_SYS_ARCH="(.*)"') re_cpu = re.compile(r'CONFIG_SYS_CPU="(.*)"') - def __init__(self, configs, options, progress, build_dir): + def __init__(self, configs, options, build_dir): """Create a new parser. Arguments: configs: A list of CONFIGs to move. options: option flags. - progress: A progress indicator build_dir: Build directory. """ self.configs = configs self.options = options - self.progress = progress self.dotconfig = os.path.join(build_dir, '.config') self.autoconf = os.path.join(build_dir, 'include', 'autoconf.mk') self.config_autoconf = os.path.join(build_dir, 'include', 'config', @@ -516,10 +514,12 @@ class KconfigParser: This function parses the generated .config and include/autoconf.mk searching the target options. Move the config option(s) to the .config as needed. - Also, display the log to show what happened to the .config. Arguments: defconfig: defconfig name. + + Returns: + Return log string """ results = [] @@ -553,11 +553,6 @@ class KconfigParser: log += log_msg(self.options.color, log_color, defconfig, actlog) - # Some threads are running in parallel. - # Print log in one shot to not mix up logs from different threads. - print log, - self.progress.show() - with open(self.dotconfig, 'a') as f: for (action, value) in results: if action == ACTION_MOVE: @@ -566,6 +561,8 @@ class KconfigParser: os.remove(self.config_autoconf) os.remove(self.autoconf) + return log + class Slot: """A slot to store a subprocess. @@ -590,7 +587,7 @@ class Slot: self.build_dir = tempfile.mkdtemp() self.devnull = devnull self.make_cmd = (make_cmd, 'O=' + self.build_dir) - self.parser = KconfigParser(configs, options, progress, self.build_dir) + self.parser = KconfigParser(configs, options, self.build_dir) self.state = STATE_IDLE self.failed_boards = [] @@ -676,7 +673,7 @@ class Slot: return True if self.state == STATE_AUTOCONF: - self.parser.update_dotconfig(self.defconfig) + self.log = self.parser.update_dotconfig(self.defconfig) """Save off the defconfig in a consistent way""" cmd = list(self.make_cmd) @@ -690,7 +687,11 @@ class Slot: if not self.options.dry_run: shutil.move(os.path.join(self.build_dir, 'defconfig'), os.path.join('configs', self.defconfig)) + # Some threads are running in parallel. + # Print log in one shot to not mix up logs from different threads. + print self.log, self.progress.inc() + self.progress.show() self.state = STATE_IDLE return True @@ -844,7 +845,6 @@ def move_config(configs, options): while not slots.empty(): time.sleep(SLEEP_TIME) - progress.show() print '' slots.show_failed_boards()