]> git.sur5r.net Git - u-boot/commitdiff
tools: moveconfig: make getting all defconfigs into helper function
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 25 Jul 2016 10:15:28 +0000 (19:15 +0900)
committerTom Rini <trini@konsulko.com>
Fri, 5 Aug 2016 11:27:17 +0000 (07:27 -0400)
I want to reuse this routine in the next commit.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
tools/moveconfig.py

index a0837140e984f1cfcf077ae75ba0d077985f49a1..d0e4b2d2f35c47236b6f13c73433995d5c1fd87c 100755 (executable)
@@ -266,6 +266,16 @@ def get_make_cmd():
         sys.exit('GNU Make not found')
     return ret[0].rstrip()
 
+def get_all_defconfigs():
+    """Get all the defconfig files under the configs/ directory."""
+    defconfigs = []
+    for (dirpath, dirnames, filenames) in os.walk('configs'):
+        dirpath = dirpath[len('configs') + 1:]
+        for filename in fnmatch.filter(filenames, '*_defconfig'):
+            defconfigs.append(os.path.join(dirpath, filename))
+
+    return defconfigs
+
 def color_text(color_enabled, color, string):
     """Return colored string."""
     if color_enabled:
@@ -1079,12 +1089,7 @@ def move_config(configs, options):
                 sys.exit('%s - defconfig does not exist. Stopping.' %
                          defconfigs[i])
     else:
-        # All the defconfig files to be processed
-        defconfigs = []
-        for (dirpath, dirnames, filenames) in os.walk('configs'):
-            dirpath = dirpath[len('configs') + 1:]
-            for filename in fnmatch.filter(filenames, '*_defconfig'):
-                defconfigs.append(os.path.join(dirpath, filename))
+        defconfigs = get_all_defconfigs()
 
     progress = Progress(len(defconfigs))
     slots = Slots(configs, options, progress, reference_src_dir)