From patchwork Mon Aug 22 13:18:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 74420 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1564517qga; Mon, 22 Aug 2016 06:17:17 -0700 (PDT) X-Received: by 10.194.184.39 with SMTP id er7mr17466167wjc.159.1471871837243; Mon, 22 Aug 2016 06:17:17 -0700 (PDT) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id em5si18426915wjb.257.2016.08.22.06.17.16; Mon, 22 Aug 2016 06:17:17 -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 E96F94B93F; Mon, 22 Aug 2016 15:17:07 +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 sYOraXX7cekW; Mon, 22 Aug 2016 15:17:07 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A5701A751E; Mon, 22 Aug 2016 15:16:58 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3BA234B62B 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 BiiFRr1MnbO6 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 618AE4B656 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 u7MDGIdv031211; Mon, 22 Aug 2016 22:16:20 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com u7MDGIdv031211 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1471871781; bh=ruQf0wg82La7GiyKavoYm1cLxVVYh8KKdzg6ALHJ3+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P0xfcNdb5rhnxNu0A4ADX92+00UcNygjWSIf2+VZCsQegbmFAKj7uhmBTS3SpLgfS xnQ/dY0WVyJQE69P1Zd0PGM81/U+QYgI+oXZY2sCsg2wCRtODsBHf6wzHN0guQ1RSh aJyxOPl62mcoAF5jHVYT1CCfAJWWsWJ/wNdsrEw7cbEGom4mmlfEbyUlp4rvXYoY8N v/CYo/DfpyehnJwQ5s7JffDiPdtxZGCBX6rUFnPk4XpMzykN5a3FQdFM+8Vtp41cXe AiDqmII2mutzkFFvzWYNg7Y9q867Lo75RCK4MDPiJFyMG/IkH0W2GxbfhfWmridufq mzTTsPLrHzi/A== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Mon, 22 Aug 2016 22:18:21 +0900 Message-Id: <1471871902-5361-4-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 3/4] tools: moveconfig: warn loudly if moved option has no entry in Kconfig 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" Currently, the tool gives up moving an option quietly if its entry was not found in Kconfig. If the option is not defined in the config header in the first place, it is no problem (as the Kconfig entry may have been hidden by reasonable "depends on"). However, if the option is defined in the config header, the missing Kconfig entry is a sign of possible behavior change. It is highly recommended to manually check if the option has been moved as expected. In this case, let's add "suspicious" in the log and change the log color (if --color option is given) to make it stand out. This was suggested by Tom in [1]. [1] http://lists.denx.de/pipermail/u-boot/2016-July/261988.html Signed-off-by: Masahiro Yamada Suggested-by: Tom Rini --- tools/moveconfig.py | 45 +++++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 14 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 93f3781..98e8608 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -47,12 +47,18 @@ It looks like one of the following: This config option was moved to the defconfig - CONFIG_... is not defined in Kconfig. Do nothing. - The entry for this CONFIG was not found in Kconfig. + The entry for this CONFIG was not found in Kconfig. The option is not + defined in the config header, either. So, this case can be just skipped. + + - CONFIG_... is not defined in Kconfig (suspicious). Do nothing. + This option is defined in the config header, but its entry was not found + in Kconfig. There are two common cases: - You forgot to create an entry for the CONFIG before running this tool, or made a typo in a CONFIG passed to this tool. - The entry was hidden due to unmet 'depends on'. - This is correct behavior. + The tool does not know if the result is reasonable, so please check it + manually. - 'CONFIG_...' is the same as the define in Kconfig. Do nothing. The define in the config header matched the one in Kconfig. @@ -210,7 +216,8 @@ STATE_SAVEDEFCONFIG = 3 ACTION_MOVE = 0 ACTION_NO_ENTRY = 1 -ACTION_NO_CHANGE = 2 +ACTION_NO_ENTRY_WARN = 2 +ACTION_NO_CHANGE = 3 COLOR_BLACK = '0;30' COLOR_RED = '0;31' @@ -659,14 +666,6 @@ class KconfigParser: """ not_set = '# %s is not set' % config - for line in dotconfig_lines: - line = line.rstrip() - if line.startswith(config + '=') or line == not_set: - old_val = line - break - else: - return (ACTION_NO_ENTRY, config) - for line in autoconf_lines: line = line.rstrip() if line.startswith(config + '='): @@ -675,6 +674,17 @@ class KconfigParser: else: new_val = not_set + for line in dotconfig_lines: + line = line.rstrip() + if line.startswith(config + '=') or line == not_set: + old_val = line + break + else: + if new_val == not_set: + return (ACTION_NO_ENTRY, config) + else: + return (ACTION_NO_ENTRY_WARN, config) + # If this CONFIG is neither bool nor trisate if old_val[-2:] != '=y' and old_val[-2:] != '=m' and old_val != not_set: # tools/scripts/define2mk.sed changes '1' to 'y'. @@ -704,6 +714,7 @@ class KconfigParser: results = [] updated = False + suspicious = False with open(self.dotconfig) as f: dotconfig_lines = f.readlines() @@ -725,6 +736,10 @@ class KconfigParser: elif action == ACTION_NO_ENTRY: actlog = "%s is not defined in Kconfig. Do nothing." % value log_color = COLOR_LIGHT_BLUE + elif action == ACTION_NO_ENTRY_WARN: + actlog = "%s is not defined in Kconfig (suspicious). Do nothing." % value + log_color = COLOR_YELLOW + suspicious = True elif action == ACTION_NO_CHANGE: actlog = "'%s' is the same as the define in Kconfig. Do nothing." \ % value @@ -744,7 +759,7 @@ class KconfigParser: os.remove(self.config_autoconf) os.remove(self.autoconf) - return (updated, log) + return (updated, suspicious, log) def check_defconfig(self): """Check the defconfig after savedefconfig @@ -923,7 +938,9 @@ class Slot: def do_savedefconfig(self): """Update the .config and run 'make savedefconfig'.""" - (updated, log) = self.parser.update_dotconfig() + (updated, suspicious, log) = self.parser.update_dotconfig() + if suspicious: + self.suspicious_boards.add(self.defconfig) self.log += log if not self.options.force_sync and not updated: @@ -994,7 +1011,7 @@ class Slot: def get_suspicious_boards(self): """Returns a set of boards (defconfigs) with possible misconversion. """ - return self.suspicious_boards + return self.suspicious_boards - self.failed_boards class Slots: