Browse Source

tools: moveconfig: skip savedefconfig if .config was not updated

If no CONFIG option is moved to the .config, no need to sync the
defconfig file.  This accelerates the processing by skipping
needless "make savedefconfig".

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Masahiro Yamada 9 years ago
parent
commit
7fb0bacd38
1 changed files with 16 additions and 5 deletions
  1. 16 5
      tools/moveconfig.py

+ 16 - 5
tools/moveconfig.py

@@ -496,10 +496,13 @@ class KconfigParser:
           defconfig: defconfig name.
           defconfig: defconfig name.
 
 
         Returns:
         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 = []
         results = []
+        updated = False
 
 
         with open(self.dotconfig) as f:
         with open(self.dotconfig) as f:
             dotconfig_lines = f.readlines()
             dotconfig_lines = f.readlines()
@@ -534,11 +537,12 @@ class KconfigParser:
             for (action, value) in results:
             for (action, value) in results:
                 if action == ACTION_MOVE:
                 if action == ACTION_MOVE:
                     f.write(value + '\n')
                     f.write(value + '\n')
+                    updated = True
 
 
         os.remove(self.config_autoconf)
         os.remove(self.config_autoconf)
         os.remove(self.autoconf)
         os.remove(self.autoconf)
 
 
-        return log
+        return (updated, log)
 
 
 class Slot:
 class Slot:
 
 
@@ -614,8 +618,11 @@ class Slot:
         If the configuration is successfully finished, assign a new
         If the configuration is successfully finished, assign a new
         subprocess to build include/autoconf.mk.
         subprocess to build include/autoconf.mk.
         If include/autoconf.mk is generated, invoke the parser to
         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:
         Returns:
           Return True if the subprocess is terminated, False otherwise
           Return True if the subprocess is terminated, False otherwise
@@ -636,8 +643,12 @@ class Slot:
             return True
             return True
 
 
         if self.state == STATE_AUTOCONF:
         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"""
             """Save off the defconfig in a consistent way"""
             cmd = list(self.make_cmd)
             cmd = list(self.make_cmd)
             cmd.append('savedefconfig')
             cmd.append('savedefconfig')