aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSimon Glass2017-06-01 19:38:59 -0600
committerSimon Glass2017-07-11 10:08:19 -0600
commitee4e61bda4b5187d2e098accbc166b9f09c94814 (patch)
tree7d49f0666a54cf5f6c462b99b9789438c6b896fd /tools
parent25f978cb1c55d2ff52db2aeaa1eacd84eec115db (diff)
moveconfig: Allow reading the defconfig list from stdin
Support passes in a defconfig filename of '-' to read the list from stdin instead of from a file. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/moveconfig.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index 390aac6f74e..c581fb6a0df 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -297,9 +297,22 @@ def get_matched_defconfig(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."""
+ """Get all the defconfig files that match the patterns in a file.
+
+ Args:
+ defconfigs_file: File containing a list of defconfigs to process, or
+ '-' to read the list from stdin
+
+ Returns:
+ A list of paths to defconfig files, with no duplicates
+ """
defconfigs = []
- for i, line in enumerate(open(defconfigs_file)):
+ if defconfigs_file == '-':
+ fd = sys.stdin
+ defconfigs_file = 'stdin'
+ else:
+ fd = open(defconfigs_file)
+ for i, line in enumerate(fd):
line = line.strip()
if not line:
continue # skip blank lines silently
@@ -1328,7 +1341,9 @@ def main():
parser.add_option('-C', '--commit', action='store_true', default=False,
help='Create a git commit for the operation')
parser.add_option('-d', '--defconfigs', type='string',
- help='a file containing a list of defconfigs to move')
+ help='a file containing a list of defconfigs to move, '
+ "one per line (for example 'snow_defconfig') "
+ "or '-' to read from stdin")
parser.add_option('-n', '--dry-run', action='store_true', default=False,
help='perform a trial run (show log with no changes)')
parser.add_option('-e', '--exit-on-error', action='store_true',