summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorSai Hari Chandana Kalluri <chandana.kalluri@xilinx.com>2019-07-10 11:27:34 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-07-17 09:36:34 +0100
commit57beed1d30723d51f8299f898daeb4b42f849856 (patch)
treec6393ca0b474f43114387c6c8f9820c26096973a /scripts/lib
parent3663a5d21687d51dd7d37aedff7baa0055200699 (diff)
downloadpoky-57beed1d30723d51f8299f898daeb4b42f849856.tar.gz
devtool: provide support for devtool menuconfig command
All packages that support the menuconfig task will be able to run devtool menuconfig command. This would allow the user to modify the current configure options and create a config fragment which can be added to a recipe using devtool finish. 1. The patch checks if devtool menuconfig command is called for a valid package. 2. It checks for oe-local-files dir within source and creates one if needed, this directory is needed to store the final generated config fragment so that devtool finish can update the recipe. 3. Menuconfig command is called for users to make necessary changes. After saving the changes, diffconfig command is run to generate the fragment. Syntax: devtool menuconfig <package name> Ex: devtool menuconfig linux-yocto The config fragment is saved as devtool-fragment.cfg within oe-local-files dir. Ex: <workspace_path>/sources/linux-yocto/oe-local-files/devtool-fragment.cfg Run devtool finish to update the recipe by appending the config fragment to SRC_URI and place a copy of the fragment within the layer where the recipe resides. Ex: devtool finish linux-yocto meta [YOCTO #10416] (From OE-Core rev: 417feb559a74b367315e8658d6ba868a4f8d1340) Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com> Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/devtool/menuconfig.py79
-rw-r--r--scripts/lib/devtool/standard.py5
2 files changed, 84 insertions, 0 deletions
diff --git a/scripts/lib/devtool/menuconfig.py b/scripts/lib/devtool/menuconfig.py
new file mode 100644
index 0000000000..95384c5333
--- /dev/null
+++ b/scripts/lib/devtool/menuconfig.py
@@ -0,0 +1,79 @@
1# OpenEmbedded Development tool - menuconfig command plugin
2#
3# Copyright (C) 2018 Xilinx
4# Written by: Chandana Kalluri <ckalluri@xilinx.com>
5#
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License version 2 as
8# published by the Free Software Foundation.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License along
16# with this program; if not, write to the Free Software Foundation, Inc.,
17# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
19"""Devtool menuconfig plugin"""
20
21import os
22import bb
23import logging
24import argparse
25import re
26import glob
27from devtool import setup_tinfoil, parse_recipe, DevtoolError, standard, exec_build_env_command
28from devtool import check_workspace_recipe
29logger = logging.getLogger('devtool')
30
31def menuconfig(args, config, basepath, workspace):
32 """Entry point for the devtool 'menuconfig' subcommand"""
33
34 rd = ""
35 kconfigpath = ""
36 pn_src = ""
37 localfilesdir = ""
38 workspace_dir = ""
39 tinfoil = setup_tinfoil(basepath=basepath)
40 try:
41 rd = parse_recipe(config, tinfoil, args.component, appends=True, filter_workspace=False)
42 if not rd:
43 return 1
44
45 check_workspace_recipe(workspace, args.component)
46 pn = rd.getVar('PN', True)
47
48 if not rd.getVarFlag('do_menuconfig','task'):
49 raise DevtoolError("This recipe does not support menuconfig option")
50
51 workspace_dir = os.path.join(config.workspace_path,'sources')
52 kconfigpath = rd.getVar('B')
53 pn_src = os.path.join(workspace_dir,pn)
54
55 # add check to see if oe_local_files exists or not
56 localfilesdir = os.path.join(pn_src,'oe-local-files')
57 if not os.path.exists(localfilesdir):
58 bb.utils.mkdirhier(localfilesdir)
59 # Add gitignore to ensure source tree is clean
60 gitignorefile = os.path.join(localfilesdir,'.gitignore')
61 with open(gitignorefile, 'w') as f:
62 f.write('# Ignore local files, by default. Remove this file if you want to commit the directory to Git\n')
63 f.write('*\n')
64
65 finally:
66 tinfoil.shutdown()
67
68 logger.info('Launching menuconfig')
69 exec_build_env_command(config.init_path, basepath, 'bitbake -c menuconfig %s' % pn, watch=True)
70 fragment = os.path.join(localfilesdir, 'devtool-fragment.cfg')
71 res = standard._create_kconfig_diff(pn_src,rd,fragment)
72
73 return 0
74
75def register_commands(subparsers, context):
76 """register devtool subcommands from this plugin"""
77 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')
78 parser_menuconfig.add_argument('component', help='compenent to alter config')
79 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 6661a21983..96af488798 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -938,6 +938,11 @@ def modify(args, config, basepath, workspace):
938 ' cp ${B}/.config ${S}/.config.baseline\n' 938 ' cp ${B}/.config ${S}/.config.baseline\n'
939 ' ln -sfT ${B}/.config ${S}/.config.new\n' 939 ' ln -sfT ${B}/.config ${S}/.config.new\n'
940 '}\n') 940 '}\n')
941 if rd.getVarFlag('do_menuconfig','task'):
942 f.write('\ndo_configure_append() {\n'
943 ' cp ${B}/.config ${S}/.config.baseline\n'
944 ' ln -sfT ${B}/.config ${S}/.config.new\n'
945 '}\n')
941 if initial_rev: 946 if initial_rev:
942 f.write('\n# initial_rev: %s\n' % initial_rev) 947 f.write('\n# initial_rev: %s\n' % initial_rev)
943 for commit in commits: 948 for commit in commits: