From patchwork Mon Aug 22 13:18:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 74419 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1564412qga; Mon, 22 Aug 2016 06:17:05 -0700 (PDT) X-Received: by 10.28.23.210 with SMTP id 201mr14672501wmx.108.1471871825389; Mon, 22 Aug 2016 06:17:05 -0700 (PDT) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id sw9si18470960wjb.19.2016.08.22.06.17.05; Mon, 22 Aug 2016 06:17:05 -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 B9D9F4BB1A; Mon, 22 Aug 2016 15:16:59 +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 31qmONriZqaG; Mon, 22 Aug 2016 15:16:59 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AD9994B9B0; Mon, 22 Aug 2016 15:16:55 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 145AA4B68A for ; Mon, 22 Aug 2016 15:16:50 +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 lpIzNLy8X-oL for ; Mon, 22 Aug 2016 15:16:50 +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 670CD4B660 for ; Mon, 22 Aug 2016 15:16:45 +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 u7MDGIdu031211; Mon, 22 Aug 2016 22:16:20 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com u7MDGIdu031211 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1471871780; bh=guwx8yeCTvW95qwzzcfUp46fNfBJ2EEbiFDlVkuCN8s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SC/l9O773ilXUJwMlGm1SxhLsskFlvGzqW0gml9ftLIJI69gUezaCAzqzUZKIf8mv lowcC3ILRdbe5POoztaPvzmvqMNz1DIgxust66K/LFv966HmdxMUy08nrXadkSphd8 cKBLvkj5iaHCA5G5mZ/Q36e/WoxuB2AFzz3BmRvly8aX0E2vjDleQCoirSTG/JB7Aw z05PJp65z4LU7VtO0VTfUXd4bpLqWvhFkZT5OVvVtq4dzFE0DUSajbiBeAzSCgrkOx LHDkyxMyaGpXVVOMmFfeBK9Csjo77NhdNnzYZ8zEBZ9Tl4Sh/OI4f/aspRFMGZpE8c MrBURHT3pPqsg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Mon, 22 Aug 2016 22:18:20 +0900 Message-Id: <1471871902-5361-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1471871902-5361-1-git-send-email-yamada.masahiro@socionext.com> References: <1471871902-5361-1-git-send-email-yamada.masahiro@socionext.com> Cc: Tom Rini , Joe Hershberger Subject: [U-Boot] [PATCH 2/4] tools: moveconfig: use sets instead of lists for failed/suspicious boards 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" The sets feature is handier for adding unique elements. Signed-off-by: Masahiro Yamada --- tools/moveconfig.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 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 c188235..93f3781 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -798,8 +798,8 @@ class Slot: self.reference_src_dir = reference_src_dir self.parser = KconfigParser(configs, options, self.build_dir) self.state = STATE_IDLE - self.failed_boards = [] - self.suspicious_boards = [] + self.failed_boards = set() + self.suspicious_boards = set() def __del__(self): """Delete the working directory @@ -946,7 +946,7 @@ class Slot: log = self.parser.check_defconfig() if log: - self.suspicious_boards.append(self.defconfig) + self.suspicious_boards.add(self.defconfig) self.log += log orig_defconfig = os.path.join('configs', self.defconfig) new_defconfig = os.path.join(self.build_dir, 'defconfig') @@ -980,19 +980,19 @@ class Slot: sys.exit("Exit on error.") # If --exit-on-error flag is not set, skip this board and continue. # Record the failed board. - self.failed_boards.append(self.defconfig) + self.failed_boards.add(self.defconfig) self.progress.inc() self.progress.show() self.state = STATE_IDLE def get_failed_boards(self): - """Returns a list of failed boards (defconfigs) in this slot. + """Returns a set of failed boards (defconfigs) in this slot. """ return self.failed_boards def get_suspicious_boards(self): - """Returns a list of boards (defconfigs) with possible misconversion. + """Returns a set of boards (defconfigs) with possible misconversion. """ return self.suspicious_boards @@ -1057,11 +1057,11 @@ class Slots: def show_failed_boards(self): """Display all of the failed boards (defconfigs).""" - boards = [] + boards = set() output_file = 'moveconfig.failed' for slot in self.slots: - boards += slot.get_failed_boards() + boards |= slot.get_failed_boards() if boards: boards = '\n'.join(boards) + '\n' @@ -1076,11 +1076,11 @@ class Slots: def show_suspicious_boards(self): """Display all boards (defconfigs) with possible misconversion.""" - boards = [] + boards = set() output_file = 'moveconfig.suspicious' for slot in self.slots: - boards += slot.get_suspicious_boards() + boards |= slot.get_suspicious_boards() if boards: boards = '\n'.join(boards) + '\n'