summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-06-02 01:38:58 (GMT)
committerSimon Glass <sjg@chromium.org>2017-07-11 16:08:19 (GMT)
commit25f978cb1c55d2ff52db2aeaa1eacd84eec115db (patch)
tree1bed695a32b451810bd78309d54fd8505a2e5480 /tools
parent69aaec0bca6a0283d21453e1b18e407a9f20b69a (diff)
downloadu-boot-fsl-qoriq-25f978cb1c55d2ff52db2aeaa1eacd84eec115db.tar.xz
moveconfig: Support providing a path to the defconfig files
It is convenient to provide the full patch to the defconfig files in some situations, e.g. when the file was generated by a shell command (e.g. 'ls configs/zynq*'). Add support for this, and move the globbing code into a function with its own documentation. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/moveconfig.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index 7aa9612..390aac6 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -278,6 +278,24 @@ def get_make_cmd():
sys.exit('GNU Make not found')
return ret[0].rstrip()
+def get_matched_defconfig(line):
+ """Get the defconfig files that match a pattern
+
+ Args:
+ line: Path or filename to match, e.g. 'configs/snow_defconfig' or
+ 'k2*_defconfig'. If no directory is provided, 'configs/' is
+ prepended
+
+ Returns:
+ a list of matching defconfig files
+ """
+ dirname = os.path.dirname(line)
+ if dirname:
+ pattern = line
+ else:
+ pattern = os.path.join('configs', line)
+ return glob.glob(pattern) + glob.glob(pattern + '_defconfig')
+
def get_matched_defconfigs(defconfigs_file):
"""Get all the defconfig files that match the patterns in a file."""
defconfigs = []
@@ -285,8 +303,7 @@ def get_matched_defconfigs(defconfigs_file):
line = line.strip()
if not line:
continue # skip blank lines silently
- pattern = os.path.join('configs', line)
- matched = glob.glob(pattern) + glob.glob(pattern + '_defconfig')
+ matched = get_matched_defconfig(line)
if not matched:
print >> sys.stderr, "warning: %s:%d: no defconfig matched '%s'" % \
(defconfigs_file, i + 1, line)