Message ID | 1431726052-6519-3-git-send-email-joe.hershberger@ni.com |
---|---|
State | Superseded |
Delegated to: | Masahiro Yamada |
Headers | show |
2015-05-16 6:40 GMT+09:00 Joe Hershberger <joe.hershberger@ni.com>: > This is helpful to re-attempt to move failed boards from a previous run > without starting over. > > Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> > > --- > > Changes in v4: None > Changes in v3: > -Fixed command line options order (alphabetize) > > Changes in v2: > -New for version 2 > > tools/moveconfig.py | 26 ++++++++++++++++++++------ > 1 file changed, 20 insertions(+), 6 deletions(-) > > diff --git a/tools/moveconfig.py b/tools/moveconfig.py > index d3009de..3f31e81 100755 > --- a/tools/moveconfig.py > +++ b/tools/moveconfig.py > @@ -135,6 +135,9 @@ Available options > Surround each portion of the log with escape sequences to display it > in color on the terminal. > > + -d, --defconfigs > + Specify a file containing a list of defconfigs to move > + > -n, --dry-run > Peform a trial run that does not make any changes. It is useful to > see what is going to happen before one actually runs it. > @@ -734,12 +737,21 @@ def move_config(config_attrs, options): > config_attr['type'], > config_attr['default']) > > - # 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)) > + if options.defconfigs: > + defconfigs = [line.strip() for line in open(options.defconfigs, 'r')] > + for i, defconfig in enumerate(defconfigs): > + if not defconfig.endswith('_defconfig'): > + defconfigs[i] = defconfig + '_defconfig' > + if not os.path.exists(os.path.join('configs', defconfigs[i])): > + sys.exit('%s - defconfig does not exist. Stopping.' % > + defconfigs[i]) 'r' is redundant for open() because read-mode is default. moveconfig.failed always prefixes _defconfig, so we need not to do so again, I think. (or will we make this file by hand?) Then, we can drop enumarate and write the error message within 80 columns. if options.defconfigs: defconfigs = [line.strip() for line in open(options.defconfigs)] for defconfig in defconfigs: if not os.path.exists(os.path.join('configs', defconfig)): sys.exit('%s: defconfig does not exist. Stopping.' % defconfig) > slots = Slots(config_attrs, options) > > @@ -840,6 +852,8 @@ def main(): > # Add options here > parser.add_option('-c', '--color', action='store_true', default=False, > help='display the log in color') > + parser.add_option('-d', '--defconfigs', type='string', > + help='a file containing a list of defconfigs to move') > 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',
Hi Masahiro-san, On Mon, May 18, 2015 at 11:33 PM, Masahiro Yamada <yamada.masahiro@socionext.com> wrote: > 2015-05-16 6:40 GMT+09:00 Joe Hershberger <joe.hershberger@ni.com>: >> This is helpful to re-attempt to move failed boards from a previous run >> without starting over. >> >> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> >> >> --- >> >> Changes in v4: None >> Changes in v3: >> -Fixed command line options order (alphabetize) >> >> Changes in v2: >> -New for version 2 >> >> tools/moveconfig.py | 26 ++++++++++++++++++++------ >> 1 file changed, 20 insertions(+), 6 deletions(-) >> >> diff --git a/tools/moveconfig.py b/tools/moveconfig.py >> index d3009de..3f31e81 100755 >> --- a/tools/moveconfig.py >> +++ b/tools/moveconfig.py >> @@ -135,6 +135,9 @@ Available options >> Surround each portion of the log with escape sequences to display it >> in color on the terminal. >> >> + -d, --defconfigs >> + Specify a file containing a list of defconfigs to move >> + >> -n, --dry-run >> Peform a trial run that does not make any changes. It is useful to >> see what is going to happen before one actually runs it. >> @@ -734,12 +737,21 @@ def move_config(config_attrs, options): >> config_attr['type'], >> config_attr['default']) >> >> - # 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)) >> + if options.defconfigs: >> + defconfigs = [line.strip() for line in open(options.defconfigs, 'r')] >> + for i, defconfig in enumerate(defconfigs): >> + if not defconfig.endswith('_defconfig'): >> + defconfigs[i] = defconfig + '_defconfig' >> + if not os.path.exists(os.path.join('configs', defconfigs[i])): >> + sys.exit('%s - defconfig does not exist. Stopping.' % >> + defconfigs[i]) > > > 'r' is redundant for open() because read-mode is default. OK. > moveconfig.failed always prefixes _defconfig, > so we need not to do so again, I think. (or will we make this file by hand?) I have done both moveconfig.failed as well as a hand-written file for testing certain boards. That's why I added both the append '_defconfig' as well as the check for it actually existing. > Then, we can drop enumarate and write the error message within 80 columns. > > if options.defconfigs: > defconfigs = [line.strip() for line in open(options.defconfigs)] > for defconfig in defconfigs: > if not os.path.exists(os.path.join('configs', defconfig)): > sys.exit('%s: defconfig does not exist. Stopping.' % defconfig) I think we should keep the check for endswith('_defconfig'). >> slots = Slots(config_attrs, options) >> >> @@ -840,6 +852,8 @@ def main(): >> # Add options here >> parser.add_option('-c', '--color', action='store_true', default=False, >> help='display the log in color') >> + parser.add_option('-d', '--defconfigs', type='string', >> + help='a file containing a list of defconfigs to move') >> 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', Cheers, -Joe
2015-05-20 2:58 GMT+09:00 Joe Hershberger <joe.hershberger@gmail.com>: > Hi Masahiro-san, > > On Mon, May 18, 2015 at 11:33 PM, Masahiro Yamada > <yamada.masahiro@socionext.com> wrote: >> 2015-05-16 6:40 GMT+09:00 Joe Hershberger <joe.hershberger@ni.com>: >>> This is helpful to re-attempt to move failed boards from a previous run >>> without starting over. >>> >>> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> >>> >>> --- >>> >>> Changes in v4: None >>> Changes in v3: >>> -Fixed command line options order (alphabetize) >>> >>> Changes in v2: >>> -New for version 2 >>> >>> tools/moveconfig.py | 26 ++++++++++++++++++++------ >>> 1 file changed, 20 insertions(+), 6 deletions(-) >>> >>> diff --git a/tools/moveconfig.py b/tools/moveconfig.py >>> index d3009de..3f31e81 100755 >>> --- a/tools/moveconfig.py >>> +++ b/tools/moveconfig.py >>> @@ -135,6 +135,9 @@ Available options >>> Surround each portion of the log with escape sequences to display it >>> in color on the terminal. >>> >>> + -d, --defconfigs >>> + Specify a file containing a list of defconfigs to move >>> + >>> -n, --dry-run >>> Peform a trial run that does not make any changes. It is useful to >>> see what is going to happen before one actually runs it. >>> @@ -734,12 +737,21 @@ def move_config(config_attrs, options): >>> config_attr['type'], >>> config_attr['default']) >>> >>> - # 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)) >>> + if options.defconfigs: >>> + defconfigs = [line.strip() for line in open(options.defconfigs, 'r')] >>> + for i, defconfig in enumerate(defconfigs): >>> + if not defconfig.endswith('_defconfig'): >>> + defconfigs[i] = defconfig + '_defconfig' >>> + if not os.path.exists(os.path.join('configs', defconfigs[i])): >>> + sys.exit('%s - defconfig does not exist. Stopping.' % >>> + defconfigs[i]) >> >> >> 'r' is redundant for open() because read-mode is default. > > OK. > >> moveconfig.failed always prefixes _defconfig, >> so we need not to do so again, I think. (or will we make this file by hand?) > > I have done both moveconfig.failed as well as a hand-written file for > testing certain boards. That's why I added both the append > '_defconfig' as well as the check for it actually existing. > >> Then, we can drop enumarate and write the error message within 80 columns. >> >> if options.defconfigs: >> defconfigs = [line.strip() for line in open(options.defconfigs)] >> for defconfig in defconfigs: >> if not os.path.exists(os.path.join('configs', defconfig)): >> sys.exit('%s: defconfig does not exist. Stopping.' % defconfig) > > I think we should keep the check for endswith('_defconfig'). OK, then. Let's keep it.
diff --git a/tools/moveconfig.py b/tools/moveconfig.py index d3009de..3f31e81 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -135,6 +135,9 @@ Available options Surround each portion of the log with escape sequences to display it in color on the terminal. + -d, --defconfigs + Specify a file containing a list of defconfigs to move + -n, --dry-run Peform a trial run that does not make any changes. It is useful to see what is going to happen before one actually runs it. @@ -734,12 +737,21 @@ def move_config(config_attrs, options): config_attr['type'], config_attr['default']) - # 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)) + if options.defconfigs: + defconfigs = [line.strip() for line in open(options.defconfigs, 'r')] + for i, defconfig in enumerate(defconfigs): + if not defconfig.endswith('_defconfig'): + defconfigs[i] = defconfig + '_defconfig' + if not os.path.exists(os.path.join('configs', defconfigs[i])): + 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)) slots = Slots(config_attrs, options) @@ -840,6 +852,8 @@ def main(): # Add options here parser.add_option('-c', '--color', action='store_true', default=False, help='display the log in color') + parser.add_option('-d', '--defconfigs', type='string', + help='a file containing a list of defconfigs to move') 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',
This is helpful to re-attempt to move failed boards from a previous run without starting over. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> --- Changes in v4: None Changes in v3: -Fixed command line options order (alphabetize) Changes in v2: -New for version 2 tools/moveconfig.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)