qconfig: Add an way to select defconfigs without stdin
PATCH 1/2 qconfig: Add an way to select defconfigs without stdin
Sometimes it is useful to process just one or two defconfigs and it is convenient to do this just by listing them in the arguments. Add a -D option for this.
Update the docs to avoid mentioning boards which have been removed.
---
doc/develop/qconfig.rst | 7 +++++-- tools/qconfig.py | 23 +++++++++++++++-------- 2 files changed, 20 insertions(+), 10 deletions(-)
doc/develop/qconfig.rst +5 -2
@@ -62,10 +62,13 @@ or:: grep -l X86 configs/* | ./tools/qconfig.py -s -d - +or:: + + ./tools/qconfig.py -s -D $(grep -l X86 configs/*) + To process CONFIG_CMD_FPGAD only for a subset of configs based on path match:: - ls configs/{hrcon*,iocon*,strider*} | \ - ./tools/qconfig.py -C CONFIG_CMD_FPGAD -d - + ./tools/qconfig.py -C CONFIG_CMD_FPGAD -D configs/{amd_versal2,am68_sk}* Finding boards with particular CONFIG combinations
tools/qconfig.py +15 -8
@@ -125,23 +125,26 @@ def get_matched_defconfig(line): 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. +def get_matched_defconfigs(defconfigs_in): + """Get all the defconfig files that match the patterns given. Args: - defconfigs_file (str): File containing a list of defconfigs to process, - or '-' to read the list from stdin + defconfigs_file (str or list of str): File containing a list of + defconfigs to process, or '-' to read the list from stdin, or a + list of defconfig names Returns: list of str: A list of paths to defconfig files, with no duplicates """ defconfigs = [] with ExitStack() as stack: - if defconfigs_file == '-': + if isinstance(defconfigs_in, list): + inf = defconfigs_in + elif defconfigs_in == '-': inf = sys.stdin - defconfigs_file = 'stdin' + defconfigs_in = 'stdin' else: - inf = stack.enter_context(open(defconfigs_file, encoding='utf-8')) + inf = stack.enter_context(open(defconfigs_in, encoding='utf-8')) for i, line in enumerate(inf): line = line.strip() if not line:
@@ -150,7 +153,7 @@ def get_matched_defconfigs(defconfigs_file): line = line.split(' ')[0] # handle 'git log' input matched = get_matched_defconfig(line) if not matched: - print(f"warning: {defconfigs_file}:{i + 1}: no defconfig matched '{line}'", + print(f"warning: {defconfigs_in}:{i + 1}: no defconfig matched '{line}'", file=sys.stderr) defconfigs += matched
@@ -738,6 +741,8 @@ def move_config(args): if args.defconfigs: defconfigs = get_matched_defconfigs(args.defconfigs) + elif args.defconfiglist: + defconfigs = get_matched_defconfigs(args.defconfiglist) else: defconfigs = get_all_defconfigs()
@@ -1532,6 +1537,8 @@ doc/develop/moveconfig.rst for documentation.''' help='a file containing a list of defconfigs to move, ' "one per line (for example 'snow_defconfig') " "or '-' to read from stdin") + parser.add_argument('-D', '--defconfiglist', type=str, nargs='*', + help='list of defconfigs to move') parser.add_argument('-e', '--exit-on-error', action='store_true', default=False, help='exit immediately on any error')
Signature · 1 line
2.43.0
PATCH 2/2 qconfig: Ignore defconfigs containing #include
Running "tools/qconfig.py -s" will re-sync files with #include in them and so un-#include them.
Ignore these and mark them as failures.
---
tools/qconfig.py | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
tools/qconfig.py +19 -4
@@ -32,6 +32,8 @@ from buildman import bsettings from buildman import kconfiglib from buildman import toolchain from u_boot_pylib import terminal +from u_boot_pylib.terminal import tprint +from u_boot_pylib import tools SHOW_GNU_MAKE = 'scripts/show-gnu-make' SLEEP_TIME=0.03
@@ -551,14 +553,25 @@ class Slot: orig_defconfig = os.path.join('configs', self.defconfig) new_defconfig = os.path.join(self.build_dir, 'defconfig') updated = not filecmp.cmp(orig_defconfig, new_defconfig) + success = True if updated: - self.log.append( - self.col.build(self.col.BLUE, 'defconfig updated', bright=True)) + # Files with #include get mangled as savedefconfig doesn't know how to + # deal with them. Ignore them + success = b'#include' not in tools.read_file(orig_defconfig) + if success: + self.log.append( + self.col.build(self.col.BLUE, 'defconfig updated', + bright=True)) + else: + self.log.append( + self.col.build(self.col.RED, 'ignored due to #include', + bright=True)) + updated = False if not self.args.dry_run and updated: shutil.move(new_defconfig, orig_defconfig) - self.finish(True) + self.finish(success) def finish(self, success): """Display log along with progress and go to the idle state.
@@ -1666,7 +1679,9 @@ def move_done(progress): """ col = progress.col if progress.failed: - print(col.build(col.RED, f'{progress.failure_msg}see {FAILED_LIST}', True)) + if progress.good: + tprint(f'{progress.good} OK, ', newline=False, colour=col.GREEN) + tprint(f'{progress.failure_msg}see {FAILED_LIST}', colour=col.RED) else: # Add enough spaces to overwrite the progress indicator print(col.build(
Signature · 1 line
2.43.0
Re: [PATCH 2/2] qconfig: Ignore defconfigs containing #include
Quoted 7 lines · Simon Glass
Running "
tools/qconfig.py-s" will re-sync files with #include in them and so un-#include them.Ignore these and mark them as failures.
How about marking them as warnings? It may be good to re-sync configs/am62px_evm_a53_defconfig for example and then re-add the #include line, but configs/am62x_evm_a53_ethboot_defconfig on the other hand very much should not be resynced. Thanks for getting on this issue so quickly.
Signature · 1 line
Tom
Re: [PATCH 2/2] qconfig: Ignore defconfigs containing #include
Hi Tom,
Quoted 8 lines · Tom Rini
Quoted 5 lines · Simon Glass
Running "
tools/qconfig.py-s" will re-sync files with #include in them and so un-#include them.Ignore these and mark them as failures.
Quoted 8 lines
Quoted 2 lines
How about marking them as warnings? It may be good to re-sync configs/am62px_evm_a53_defconfig for example and then re-add the #include line, but configs/am62x_evm_a53_ethboot_defconfig on the other hand very much should not be resynced. Thanks for getting on this issue so quickly.
Do you mean still do the resync, but show a warning? It does obliterate the old defconfig, but I suppose people can just not commit the changes. Is that what you are thinking?
Regards,
SImon
Re: [PATCH 2/2] qconfig: Ignore defconfigs containing #include
Quoted 20 lines · Simon Glass
Hi Tom,
Quoted 8 lines · Tom Rini
Quoted 5 lines · Simon Glass
Running "
tools/qconfig.py-s" will re-sync files with #include in them and so un-#include them.Ignore these and mark them as failures.
Quoted 8 lines
Quoted 2 lines
How about marking them as warnings? It may be good to re-sync configs/am62px_evm_a53_defconfig for example and then re-add the #include line, but configs/am62x_evm_a53_ethboot_defconfig on the other hand very much should not be resynced. Thanks for getting on this issue so quickly.
Quoted 3 lines
Do you mean still do the resync, but show a warning? It does obliterate the old defconfig, but I suppose people can just not commit the changes. Is that what you are thinking?
No, sorry for being unclear. I was thinking it should NOT be resynced but counted as a warning not a failure.
Signature · 1 line
Tom
Re: [PATCH 2/2] qconfig: Ignore defconfigs containing #include
Hi Tom,
Quoted 22 lines · Tom Rini
Quoted 20 lines · Simon Glass
Hi Tom,
Quoted 16 lines · Tom Rini
Quoted 7 lines · Simon Glass
Running "
tools/qconfig.py-s" will re-sync files with #include in them and so un-#include them.Ignore these and mark them as failures.
How about marking them as warnings? It may be good to re-sync configs/am62px_evm_a53_defconfig for example and then re-add the #include line, but configs/am62x_evm_a53_ethboot_defconfig on the other hand very much should not be resynced. Thanks for getting on this issue so quickly.
Quoted 6 lines
Quoted 3 lines
Do you mean still do the resync, but show a warning? It does obliterate the old defconfig, but I suppose people can just not commit the changes. Is that what you are thinking?
No, sorry for being unclear. I was thinking it should NOT be resynced but counted as a warning not a failure.
Well qconfig doesn't have the concept of a warning, or at least not in the title. How important is this?
Regards,
Simon
Re: [PATCH 2/2] qconfig: Ignore defconfigs containing #include
Quoted 29 lines · Simon Glass
Hi Tom,
Quoted 26 lines · Tom Rini
Quoted 23 lines · Simon Glass
Hi Tom,
Quoted 8 lines · Tom Rini
Quoted 5 lines · Simon Glass
Running "
tools/qconfig.py-s" will re-sync files with #include in them and so un-#include them.Ignore these and mark them as failures.
Quoted 8 lines
Quoted 2 lines
How about marking them as warnings? It may be good to re-sync configs/am62px_evm_a53_defconfig for example and then re-add the #include line, but configs/am62x_evm_a53_ethboot_defconfig on the other hand very much should not be resynced. Thanks for getting on this issue so quickly.
Do you mean still do the resync, but show a warning? It does obliterate the old defconfig, but I suppose people can just not commit the changes. Is that what you are thinking?
Quoted 5 lines
Quoted 2 lines
No, sorry for being unclear. I was thinking it should NOT be resynced but counted as a warning not a failure.
Well qconfig doesn't have the concept of a warning, or at least not in the title. How important is this?
I assumed it was using the same status counter bar that buildman uses. If you can't easily do warning not error, OK.
Signature · 1 line
Tom
Re: [PATCH 2/2] qconfig: Ignore defconfigs containing #include
Hi Tom,
Quoted 31 lines · Tom Rini
Quoted 29 lines · Simon Glass
Hi Tom,
Quoted 26 lines · Tom Rini
Quoted 23 lines · Simon Glass
Hi Tom,
Quoted 8 lines · Tom Rini
Quoted 5 lines · Simon Glass
Running "
tools/qconfig.py-s" will re-sync files with #include in them and so un-#include them.Ignore these and mark them as failures.
Quoted 8 lines
Quoted 2 lines
How about marking them as warnings? It may be good to re-sync configs/am62px_evm_a53_defconfig for example and then re-add the #include line, but configs/am62x_evm_a53_ethboot_defconfig on the other hand very much should not be resynced. Thanks for getting on this issue so quickly.
Do you mean still do the resync, but show a warning? It does obliterate the old defconfig, but I suppose people can just not commit the changes. Is that what you are thinking?
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
No, sorry for being unclear. I was thinking it should NOT be resynced but counted as a warning not a failure.
Well qconfig doesn't have the concept of a warning, or at least not in the title. How important is this?
I assumed it was using the same status counter bar that buildman uses. If you can't easily do warning not error, OK.
No, it's a completely different program, unfortunately.
Regards,
Simon
Quoted 7 lines · Simon Glass
Sometimes it is useful to process just one or two defconfigs and it is convenient to do this just by listing them in the arguments. Add a -D option for this.
Update the docs to avoid mentioning boards which have been removed.
Signed-off-by Simon Glass <[email protected]>
Much handier than giving a file descriptor via <(shell cmd).
Signature · 1 line
Tom