All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 5/5] tools: moveconfig: show suspicious boards with possible misconversion
Date: Wed, 15 Jun 2016 14:33:54 +0900	[thread overview]
Message-ID: <1465968834-17361-6-git-send-email-yamada.masahiro@socionext.com> (raw)
In-Reply-To: <1465968834-17361-1-git-send-email-yamada.masahiro@socionext.com>

There are some cases where config options are moved, but they are
ripped off at the final savedefconfig stage:

  - The moved option is not user-configurable, for example, due to
    a missing prompt in the Kconfig entry

  - The config was not defined in the original config header despite
    the Kconfig specifies it as non-bool type

  - The config define in the header contains reference to another
    macro, for example:
        #define CONFIG_CONS_INDEX     (CONFIG_SYS_LPC32XX_UART - 2)
    The current moveconfig does not support recursive macro expansion.

In these cases, the conversion is very likely to be an unexpected
result.  That is why I decided to display the log in yellow color
in commit 5da4f857beac ("tools: moveconfig: report when CONFIGs are
removed by savedefconfig").

It would be nice to display the list of suspicious boards when the
tool finishes processing.  It is highly recommended to check the
defconfigs once again when this message is displayed.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 tools/moveconfig.py | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index f795a7f..bf60dbc 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -611,6 +611,7 @@ class Slot:
         self.parser = KconfigParser(configs, options, self.build_dir)
         self.state = STATE_IDLE
         self.failed_boards = []
+        self.suspicious_boards = []
 
     def __del__(self):
         """Delete the working directory
@@ -755,7 +756,10 @@ class Slot:
     def update_defconfig(self):
         """Update the input defconfig and go back to the idle state."""
 
-        self.log += self.parser.check_defconfig()
+        log = self.parser.check_defconfig()
+        if log:
+            self.suspicious_boards.append(self.defconfig)
+            self.log += log
         orig_defconfig = os.path.join('configs', self.defconfig)
         new_defconfig = os.path.join(self.build_dir, 'defconfig')
         updated = not filecmp.cmp(orig_defconfig, new_defconfig)
@@ -799,6 +803,11 @@ class Slot:
         """
         return self.failed_boards
 
+    def get_suspicious_boards(self):
+        """Returns a list of boards (defconfigs) with possible misconversion.
+        """
+        return self.suspicious_boards
+
 class Slots:
 
     """Controller of the array of subprocess slots."""
@@ -877,6 +886,26 @@ class Slots:
             with open(output_file, 'w') as f:
                 f.write(boards)
 
+    def show_suspicious_boards(self):
+        """Display all boards (defconfigs) with possible misconversion."""
+        boards = []
+        output_file = 'moveconfig.suspicious'
+
+        for slot in self.slots:
+            boards += slot.get_suspicious_boards()
+
+        if boards:
+            boards = '\n'.join(boards) + '\n'
+            msg = "The following boards might have been converted incorrectly.\n"
+            msg += "It is highly recommended to check them manually:\n"
+            msg += boards
+            msg += "(the list has been saved in %s)\n" % output_file
+            print >> sys.stderr, color_text(self.options.color, COLOR_YELLOW,
+                                            msg)
+
+            with open(output_file, 'w') as f:
+                f.write(boards)
+
 class ReferenceSource:
 
     """Reference source against which original configs should be parsed."""
@@ -967,6 +996,7 @@ def move_config(configs, options):
 
     print ''
     slots.show_failed_boards()
+    slots.show_suspicious_boards()
 
 def main():
     try:
-- 
1.9.1

  parent reply	other threads:[~2016-06-15  5:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-15  5:33 [U-Boot] [PATCH 0/5] tools: moveconfig: some more fix, cleanups, improvement Masahiro Yamada
2016-06-15  5:33 ` [U-Boot] [PATCH 1/5] tools: moveconfig: fix needless move for config with default 1 Masahiro Yamada
2016-06-20 21:25   ` Joe Hershberger
2016-06-15  5:33 ` [U-Boot] [PATCH 2/5] tools: moveconfig: change class WorkDir to class ReferenceSource Masahiro Yamada
2016-06-20 21:28   ` Joe Hershberger
2016-06-15  5:33 ` [U-Boot] [PATCH 3/5] tools: moveconfig: simplify source tree switching Masahiro Yamada
2016-06-20 21:33   ` Joe Hershberger
2016-06-21  1:53     ` Masahiro Yamada
2016-06-21 16:25       ` Joe Hershberger
2016-06-21 21:13         ` Masahiro Yamada
2016-06-21 21:41           ` Joe Hershberger
2016-06-15  5:33 ` [U-Boot] [PATCH 4/5] tools: moveconfig: simplify show_failed_boards() and show more info Masahiro Yamada
2016-06-20 21:35   ` Joe Hershberger
2016-06-15  5:33 ` Masahiro Yamada [this message]
2016-06-20 21:37   ` [U-Boot] [PATCH 5/5] tools: moveconfig: show suspicious boards with possible misconversion Joe Hershberger
2016-06-22  0:25 ` [U-Boot] [PATCH 0/5] tools: moveconfig: some more fix, cleanups, improvement Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1465968834-17361-6-git-send-email-yamada.masahiro@socionext.com \
    --to=yamada.masahiro@socionext.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.