Skip to content
Snippets Groups Projects
Commit 25f978cb authored by Simon Glass's avatar Simon Glass
Browse files

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: default avatarSimon Glass <sjg@chromium.org>
parent 69aaec0b
No related branches found
No related tags found
No related merge requests found
...@@ -278,6 +278,24 @@ def get_make_cmd(): ...@@ -278,6 +278,24 @@ def get_make_cmd():
sys.exit('GNU Make not found') sys.exit('GNU Make not found')
return ret[0].rstrip() 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): def get_matched_defconfigs(defconfigs_file):
"""Get all the defconfig files that match the patterns in a file.""" """Get all the defconfig files that match the patterns in a file."""
defconfigs = [] defconfigs = []
...@@ -285,8 +303,7 @@ def get_matched_defconfigs(defconfigs_file): ...@@ -285,8 +303,7 @@ def get_matched_defconfigs(defconfigs_file):
line = line.strip() line = line.strip()
if not line: if not line:
continue # skip blank lines silently continue # skip blank lines silently
pattern = os.path.join('configs', line) matched = get_matched_defconfig(line)
matched = glob.glob(pattern) + glob.glob(pattern + '_defconfig')
if not matched: if not matched:
print >> sys.stderr, "warning: %s:%d: no defconfig matched '%s'" % \ print >> sys.stderr, "warning: %s:%d: no defconfig matched '%s'" % \
(defconfigs_file, i + 1, line) (defconfigs_file, i + 1, line)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment