diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2016-07-25 19:15:28 +0900 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-08-05 07:27:17 -0400 |
commit | 684c306ec4252797c3085defd63eb6d3177fca36 (patch) | |
tree | a260c2502a4112beddea39fcc9763fdb2e2f731c /tools | |
parent | a3a779f7f7b5e48672b4e049beadc0112ff1c342 (diff) | |
download | u-boot-684c306ec4252797c3085defd63eb6d3177fca36.tar.gz u-boot-684c306ec4252797c3085defd63eb6d3177fca36.tar.bz2 u-boot-684c306ec4252797c3085defd63eb6d3177fca36.zip |
tools: moveconfig: make getting all defconfigs into helper function
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>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/moveconfig.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/tools/moveconfig.py b/tools/moveconfig.py index a0837140e9..d0e4b2d2f3 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -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) |