* [master][PATCH] menuconfig: Add mechanism for user to append to same devtool fragment after user runs finish
@ 2019-10-07 18:14 Sai Hari Chandana Kalluri
2019-10-07 18:32 ` ✗ patchtest: failure for " Patchwork
2019-10-09 1:55 ` [master][PATCH] " Paul Eggleton
0 siblings, 2 replies; 3+ messages in thread
From: Sai Hari Chandana Kalluri @ 2019-10-07 18:14 UTC (permalink / raw)
To: openembedded-core; +Cc: Sai Hari Chandana Kalluri
In current devtool flow, if user runs devtool modify, menuconfig and
finish, it will create a devtool-fragment.cfg and append to SRC_URI of
the recipe.
When a user runs the same flow multiple times, the devtool-fragment.cfg
created in previous iteration gets replaced with the new fragment
created in the current iteration. As a result, user can lose config
changes made previously.
Provide menuconfig with an option -a or --allow-append that lets users
to continue append to previous iteration of devtool-fragment.cfg.
Ex. devtool menuconfig linux-xlnx -a
By default, the devtool flow will replace the config fragment unless
specified with the -a option.
Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com>
---
scripts/lib/devtool/menuconfig.py | 31 ++++++++++++++++++++-----------
scripts/lib/devtool/standard.py | 20 +++++++++++++++++++-
2 files changed, 39 insertions(+), 12 deletions(-)
diff --git a/scripts/lib/devtool/menuconfig.py b/scripts/lib/devtool/menuconfig.py
index 95384c5..d718844 100644
--- a/scripts/lib/devtool/menuconfig.py
+++ b/scripts/lib/devtool/menuconfig.py
@@ -32,10 +32,8 @@ def menuconfig(args, config, basepath, workspace):
"""Entry point for the devtool 'menuconfig' subcommand"""
rd = ""
- kconfigpath = ""
- pn_src = ""
localfilesdir = ""
- workspace_dir = ""
+ fragname = "devtool-fragment.cfg"
tinfoil = setup_tinfoil(basepath=basepath)
try:
rd = parse_recipe(config, tinfoil, args.component, appends=True, filter_workspace=False)
@@ -48,12 +46,10 @@ def menuconfig(args, config, basepath, workspace):
if not rd.getVarFlag('do_menuconfig','task'):
raise DevtoolError("This recipe does not support menuconfig option")
- workspace_dir = os.path.join(config.workspace_path,'sources')
- kconfigpath = rd.getVar('B')
- pn_src = os.path.join(workspace_dir,pn)
+ srctree=rd.getVar('S',True)
# add check to see if oe_local_files exists or not
- localfilesdir = os.path.join(pn_src,'oe-local-files')
+ localfilesdir = os.path.join(srctree,'oe-local-files')
if not os.path.exists(localfilesdir):
bb.utils.mkdirhier(localfilesdir)
# Add gitignore to ensure source tree is clean
@@ -62,18 +58,31 @@ def menuconfig(args, config, basepath, workspace):
f.write('# Ignore local files, by default. Remove this file if you want to commit the directory to Git\n')
f.write('*\n')
+ if args.allow_append:
+ with open(os.path.join(srctree,'.run-devtool-menuconfig'),'w') as f:
+ f.write('RUN-DEVTOOL-MENUCONFIG=1')
+
+
finally:
- tinfoil.shutdown()
+ tinfoil.shutdown()
+
+ if args.allow_append:
+ if not os.path.exists(os.path.join(localfilesdir,'devtool-fragment.cfg')):
+ fragname = "devtool-fragment.cfg"
+ else:
+ fragname = "devtool-fragment_tmp001.cfg"
logger.info('Launching menuconfig')
exec_build_env_command(config.init_path, basepath, 'bitbake -c menuconfig %s' % pn, watch=True)
- fragment = os.path.join(localfilesdir, 'devtool-fragment.cfg')
- res = standard._create_kconfig_diff(pn_src,rd,fragment)
+
+ fragment = os.path.join(localfilesdir, fragname)
+ res = standard._create_kconfig_diff(srctree,rd,fragment)
return 0
def register_commands(subparsers, context):
"""register devtool subcommands from this plugin"""
- parser_menuconfig = subparsers.add_parser('menuconfig',help='Alter build-time configuration for a recipe', description='Launches the make menuconfig command (for recipes where do_menuconfig is available), allowing users to make changes to the build-time configuration. Creates a config fragment corresponding to changes made.', group='advanced')
+ parser_menuconfig = subparsers.add_parser('menuconfig',help='Alter build-time configuration for a recipe', description='Launches the make menuconfig command(for recipes where do_menuconfig is available), allowing users to make changes to the build-time configuration. Creates a config fragment corresponding to changes made.', group='advanced')
parser_menuconfig.add_argument('component', help='compenent to alter config')
+ parser_menuconfig.add_argument('-a','--allow-append',action="store_true",help='append devtool-fragment.cfg to previous iteration fragment')
parser_menuconfig.set_defaults(func=menuconfig,fixed_setup=context.fixed_setup)
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 1c0cd8a..a3941d9 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -1382,6 +1382,24 @@ def _export_local_files(srctree, rd, destdir, srctreebase):
removed = OrderedDict()
local_files_dir = os.path.join(srctreebase, 'oe-local-files')
git_files = _git_ls_tree(srctree)
+
+ tmpfragname=os.path.join(local_files_dir,'devtool-fragment_tmp001.cfg')
+
+ run_do_menuconfig = 0
+ checkmenuconfig = os.path.join(srctreebase,'.run-devtool-menuconfig')
+ if os.path.exists(checkmenuconfig):
+ with open(checkmenuconfig,'r') as f:
+ if 'RUN-DEVTOOL-MENUCONFIG=1' in f.read():
+ run_do_menuconfig = 1
+ os.remove(checkmenuconfig)
+
+ if os.path.exists(tmpfragname):
+ with open(tmpfragname,"r") as fin:
+ tempfragcontents=fin.read()
+ with open(os.path.join(local_files_dir,'devtool-fragment.cfg'),"+a") as fout:
+ fout.write(tempfragcontents)
+ os.remove(tmpfragname)
+
if 'oe-local-files' in git_files:
# If tracked by Git, take the files from srctree HEAD. First get
# the tree object of the directory
@@ -1400,7 +1418,7 @@ def _export_local_files(srctree, rd, destdir, srctreebase):
new_set = []
# Special handling for kernel config
- if bb.data.inherits_class('kernel-yocto', rd):
+ if not run_do_menuconfig and bb.data.inherits_class('kernel-yocto', rd):
fragment_fn = 'devtool-fragment.cfg'
fragment_path = os.path.join(destdir, fragment_fn)
if _create_kconfig_diff(srctree, rd, fragment_path):
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* ✗ patchtest: failure for menuconfig: Add mechanism for user to append to same devtool fragment after user runs finish
2019-10-07 18:14 [master][PATCH] menuconfig: Add mechanism for user to append to same devtool fragment after user runs finish Sai Hari Chandana Kalluri
@ 2019-10-07 18:32 ` Patchwork
2019-10-09 1:55 ` [master][PATCH] " Paul Eggleton
1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2019-10-07 18:32 UTC (permalink / raw)
To: Sai Hari Chandana Kalluri; +Cc: openembedded-core
== Series Details ==
Series: menuconfig: Add mechanism for user to append to same devtool fragment after user runs finish
Revision: 1
URL : https://patchwork.openembedded.org/series/20345/
State : failure
== Summary ==
Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following failures:
* Patch [master] menuconfig: Add mechanism for user to append to same devtool fragment after user runs finish
Issue Commit shortlog is too long [test_shortlog_length]
Suggested fix Edit shortlog so that it is 90 characters or less (currently 92 characters)
If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).
---
Guidelines: https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [master][PATCH] menuconfig: Add mechanism for user to append to same devtool fragment after user runs finish
2019-10-07 18:14 [master][PATCH] menuconfig: Add mechanism for user to append to same devtool fragment after user runs finish Sai Hari Chandana Kalluri
2019-10-07 18:32 ` ✗ patchtest: failure for " Patchwork
@ 2019-10-09 1:55 ` Paul Eggleton
1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggleton @ 2019-10-09 1:55 UTC (permalink / raw)
To: Sai Hari Chandana Kalluri; +Cc: openembedded-core
Hi Chandana,
On Tuesday, 8 October 2019 7:14:18 AM NZDT Sai Hari Chandana Kalluri wrote:
> In current devtool flow, if user runs devtool modify, menuconfig and
> finish, it will create a devtool-fragment.cfg and append to SRC_URI of
> the recipe.
>
> When a user runs the same flow multiple times, the devtool-fragment.cfg
> created in previous iteration gets replaced with the new fragment
> created in the current iteration. As a result, user can lose config
> changes made previously.
>
> Provide menuconfig with an option -a or --allow-append that lets users
> to continue append to previous iteration of devtool-fragment.cfg.
> Ex. devtool menuconfig linux-xlnx -a
>
> By default, the devtool flow will replace the config fragment unless
> specified with the -a option.
Functionality-wise his change looks reasonable. However I think it might be
worth taking a step back and seeing if there is a way we can improve the
workflow here. I think it's possible that you might want to create several
config fragments for different features (which would of course need their own
names), would you agree? If so I think you would want to be able to specify
the fragment name, but even if it wasn't specified it should auto-generate a
new name each time rather than hard-coding devtool-fragment.cfg. If it's
smart, it could allow editing fragments in the middle of a stack of multiple
fragments, but that would be a bonus.
As for the code itself, could you please (a) ensure you use PEP-8 compliant
spacing and four-space indentation everywhere and (b) don't undo changes that
were made to the code when it was merged - I could be wrong but it looks to me
as if you started with an earlier version of the file. If in doubt please
review the patch before sending and make sure it is only making changes that
you expect it to.
Thanks
Paul
--
Paul Eggleton
Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-09 2:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-07 18:14 [master][PATCH] menuconfig: Add mechanism for user to append to same devtool fragment after user runs finish Sai Hari Chandana Kalluri
2019-10-07 18:32 ` ✗ patchtest: failure for " Patchwork
2019-10-09 1:55 ` [master][PATCH] " Paul Eggleton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox