[U-Boot] [PATCH 06/21] tools: moveconfig: exit with error message for not clean directory

Masahiro Yamada yamada.masahiro at socionext.com
Thu May 19 08:51:54 CEST 2016


When the source tree is not clean, this tool raises an exception
with a message like follows:

Traceback (most recent call last):
  File "tools/moveconfig.py", line 939, in <module>
    main()
  File "tools/moveconfig.py", line 934, in main
    move_config(config_attrs, options)
  File "tools/moveconfig.py", line 808, in move_config
    while not slots.available():
  File "tools/moveconfig.py", line 733, in available
    if slot.poll():
  File "tools/moveconfig.py", line 645, in poll
    self.parser.update_dotconfig(self.defconfig)
  File "tools/moveconfig.py", line 503, in update_dotconfig
    with open(autoconf_path) as f:
IOError: [Errno 2] No such file or directory: '/tmp/tmpDtzCgl/include/autoconf.mk'

This does not explain clearly what is wrong.  Show an appropriate
error message "srctree is not clean, please run 'make mrproper'"
in such a situation.

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

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

diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index 7e916c2..3da4726 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -252,6 +252,12 @@ def check_top_directory():
         if not os.path.exists(f):
             sys.exit('Please run at the top of source directory.')
 
+def check_clean_directory():
+    """Exit if the source tree is not clean."""
+    for f in ('.config', 'include/config'):
+        if os.path.exists(f):
+            sys.exit("srctree is not clean, please run 'make mrproper'")
+
 def get_make_cmd():
     """Get the command name of GNU Make.
 
@@ -932,6 +938,8 @@ def main():
 
     check_top_directory()
 
+    check_clean_directory()
+
     update_cross_compile(options.color)
 
     if not options.cleanup_headers_only:
-- 
1.9.1



More information about the U-Boot mailing list