diff mbox

[18/21] tools: moveconfig: report when CONFIGs are removed by savedefconfig

Message ID 1463640729-25666-19-git-send-email-yamada.masahiro@socionext.com
State Accepted
Commit 5da4f857beac1cf859aefac3cf2ae980115ec1ae
Headers show

Commit Message

Masahiro Yamada May 19, 2016, 6:52 a.m. UTC
This is a rare case, but there is still possibility that some CONFIG
is moved to the .config, but it is removed by "make savedefconfig".
(For example, it happens when the specified CONFIG has no prompt in
the Kconfig entry, i.e. it is not user-configurable.)

It might be an unexpected case.  So, display the log in this case
(in yellow color to gain user's attention if --color option is given).

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

---

 tools/moveconfig.py | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

-- 
1.9.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
diff mbox

Patch

diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index 80542c5..9c73b30 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -432,6 +432,7 @@  class KconfigParser:
         self.autoconf = os.path.join(build_dir, 'include', 'autoconf.mk')
         self.config_autoconf = os.path.join(build_dir, 'include', 'config',
                                             'auto.conf')
+        self.defconfig = os.path.join(build_dir, 'defconfig')
 
     def get_cross_compile(self):
         """Parse .config file and return CROSS_COMPILE.
@@ -564,11 +565,35 @@  class KconfigParser:
                     f.write(value + '\n')
                     updated = True
 
+        self.results = results
         os.remove(self.config_autoconf)
         os.remove(self.autoconf)
 
         return (updated, log)
 
+    def check_defconfig(self):
+        """Check the defconfig after savedefconfig
+
+        Returns:
+          Return additional log if moved CONFIGs were removed again by
+          'make savedefconfig'.
+        """
+
+        log = ''
+
+        with open(self.defconfig) as f:
+            defconfig_lines = f.readlines()
+
+        for (action, value) in self.results:
+            if action != ACTION_MOVE:
+                continue
+            if not value + '\n' in defconfig_lines:
+                log += color_text(self.options.color, COLOR_YELLOW,
+                                  "'%s' was removed by savedefconfig.\n" %
+                                  value)
+
+        return log
+
 class Slot:
 
     """A slot to store a subprocess.
@@ -691,6 +716,7 @@  class Slot:
             return False
 
         if self.state == STATE_SAVEDEFCONFIG:
+            self.log += self.parser.check_defconfig()
             if not self.options.dry_run:
                 shutil.move(os.path.join(self.build_dir, 'defconfig'),
                             os.path.join('configs', self.defconfig))