[16/21] tools: moveconfig: skip savedefconfig if .config was not updated

Message ID 1463640729-25666-17-git-send-email-yamada.masahiro@socionext.com
State New
Headers show

Commit Message

Masahiro Yamada May 19, 2016, 6:52 a.m.
If no CONFIG option is moved to the .config, no need to sync the
defconfig file.  This accelerates the processing by skipping
unneeded "make savedefconfig".

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

---

 tools/moveconfig.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

-- 
1.9.1

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

Patch

diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index da7120d..cb26b14 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -521,10 +521,13 @@  class KconfigParser:
           defconfig: defconfig name.
 
         Returns:
-          Return log string
+          Return a tuple of (updated flag, log string).
+          The "updated flag" is True if the .config was updated, False
+          otherwise.  The "log string" shows what happend to the .config.
         """
 
         results = []
+        updated = False
 
         with open(self.dotconfig) as f:
             dotconfig_lines = f.readlines()
@@ -559,11 +562,12 @@  class KconfigParser:
             for (action, value) in results:
                 if action == ACTION_MOVE:
                     f.write(value + '\n')
+                    updated = True
 
         os.remove(self.config_autoconf)
         os.remove(self.autoconf)
 
-        return log
+        return (updated, log)
 
 class Slot:
 
@@ -646,8 +650,11 @@  class Slot:
         If the configuration is successfully finished, assign a new
         subprocess to build include/autoconf.mk.
         If include/autoconf.mk is generated, invoke the parser to
-        parse the .config and the include/autoconf.mk, and then set the
-        slot back to the idle state.
+        parse the .config and the include/autoconf.mk, moving
+        config options to the .config as needed.
+        If the .config was updated, run "make savedefconfig" to sync
+        it, update the original defconfig, and then set the slot back
+        to the idle state.
 
         Returns:
           Return True if the subprocess is terminated, False otherwise
@@ -668,8 +675,12 @@  class Slot:
             return True
 
         if self.state == STATE_AUTOCONF:
-            self.log += self.parser.update_dotconfig()
+            (updated, log) = self.parser.update_dotconfig()
+            self.log += log
 
+            if not updated:
+                self.finish(True)
+                return True
             """Save off the defconfig in a consistent way"""
             cmd = list(self.make_cmd)
             cmd.append('savedefconfig')