All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Devtool: provide easy means of reconfiguring the kernel
@ 2018-12-05  0:37 Sai Hari Chandana Kalluri
  2018-12-05  0:37 ` [PATCH 1/3] devtool modify: Update devtool modify to copy source from work-shared if its already downloaded Sai Hari Chandana Kalluri
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Sai Hari Chandana Kalluri @ 2018-12-05  0:37 UTC (permalink / raw)
  To: openembedded-core; +Cc: Sai Hari Chandana Kalluri

This patch series provides support for the user to run menuconfig command in the 
devtool flow. This would allow the user to modify the current configurations and 
generate a config fragment to update the recipe using devtool finish. Devtool
menuconfig command will work on all packages that contain menuconfig as a task.

1. The implementation 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.

Currently, when the user runs devtool modify command, it checks out the entire
source tree which is a bit of an over head in time and space. This patch series
also provides a way to create a copy(hard links) of the kernel source, if
present, from work-shared to workspace to be more efficient .

Also, if the kernel source is not present in the staging kernel dir and the user
fetches the source tree in workspace using devtool modify, then this patch
series creates a copy of source from workspace to work-shared. This is
necessary for packages that may use the kernel source.

[YOCTO #10416]

Sai Hari Chandana Kalluri (3):
  devtool modify: Update devtool modify to copy source from work-shared
    if     its already downloaded.
  devtool modify: Create a copy of kernel source within work-shared if
    not     present
  devtool: provide support for devtool menuconfig command.

 scripts/lib/devtool/menuconfig.py |  80 +++++++++++++++++++++++
 scripts/lib/devtool/standard.py   | 134 ++++++++++++++++++++++++++++++++++++--
 2 files changed, 209 insertions(+), 5 deletions(-)
 create mode 100644 scripts/lib/devtool/menuconfig.py

-- 
2.7.4



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] devtool modify: Update devtool modify to copy source from work-shared if its already downloaded.
  2018-12-05  0:37 [PATCH 0/3] Devtool: provide easy means of reconfiguring the kernel Sai Hari Chandana Kalluri
@ 2018-12-05  0:37 ` Sai Hari Chandana Kalluri
  2018-12-06 14:23   ` Mittal, Anuj
  2018-12-05  0:37 ` [PATCH 2/3] devtool modify: Create a copy of kernel source Sai Hari Chandana Kalluri
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Sai Hari Chandana Kalluri @ 2018-12-05  0:37 UTC (permalink / raw)
  To: openembedded-core; +Cc: Sai Hari Chandana Kalluri

In the regular devtool modify flow, the kernel source is fetched by running
do_fetch task. This is an overhead in time and space.

This patch updates modify command to check if the kernel source is already
downloaded. If so, then instead of calling do_fetch, copy the source from
work-shared to devtool workspace by creating hard links to be more efficient.
Else run the usual devtool modify flow and call do_fetch task.

[YOCTO #10416]

Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com>
Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com>
---
 scripts/lib/devtool/standard.py | 124 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 120 insertions(+), 4 deletions(-)

diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index d14b7a6..3a8222a 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -712,6 +712,53 @@ def _check_preserve(config, recipename):
                     tf.write(line)
     os.rename(newfile, origfile)
 
+# Function links a file from src location to dest location
+def copy_file(c,dest):
+    import errno
+    destdir = os.path.dirname(dest)
+    if os.path.islink(c):
+       linkto = os.readlink(c)
+       if os.path.lexists(dest):
+            if not os.path.islink(dest):
+                raise OSError(errno.EEXIST, "Link %s already exists as a file" % dest, dest)
+            if os.readlink(dest) == linkto:
+                return dest
+            raise OSError(errno.EEXIST, "Link %s already exists to a different location? (%s vs %s)" % (dest, os.readlink(dest), linkto), dest)
+       os.symlink(linkto, dest)
+    else:
+       try:
+           os.link(c, dest)
+       except OSError as err:
+           if err.errno == errno.EXDEV:
+                bb.utils.copyfile(c, dest)
+           else:
+                raise
+
+# Function creates folders in a given target location
+def copy_dirs(root,dirs,target):
+    for d in dirs:
+        destdir =  os.path.join(target,d)
+        if os.path.islink(os.path.join(root,d)):
+             linkto = os.readlink(os.path.join(root,d))
+             os.symlink(linkto,destdir) 
+        else:
+             bb.utils.mkdirhier(target+d)
+
+# Function to link src dir to dest dir
+def copy_src_to_ws(srcdir,srctree):
+    target = srctree
+    if os.path.exists(target):
+        raise DevtoolError('source already in your workspace')
+
+    bb.utils.mkdirhier(target)
+    for root,dirs,files in os.walk(srcdir):
+        #convert abspath to relpath for root
+        destdir = root.replace(srcdir,"")
+        target = srctree+destdir+"/"
+        copy_dirs(root,dirs,target)  
+        for f in files:
+           copy_file(os.path.join(root,f),os.path.join(target,f))
+
 def modify(args, config, basepath, workspace):
     """Entry point for the devtool 'modify' subcommand"""
     import bb
@@ -758,6 +805,73 @@ def modify(args, config, basepath, workspace):
         initial_rev = None
         commits = []
         check_commits = False
+
+        if bb.data.inherits_class('kernel-yocto', rd):
+               srcdir = rd.getVar('STAGING_KERNEL_DIR')
+               if os.path.exists(srcdir) and os.listdir(srcdir):
+                  copy_src_to_ws(srcdir,srctree)
+
+                  workdir = rd.getVar('WORKDIR')
+                  srcsubdir = rd.getVar('S')
+                  localfilesdir = os.path.join(srctree,'oe-local-files') 
+                  # Move local source files into separate subdir
+                  recipe_patches = [os.path.basename(patch) for patch in oe.recipeutils.get_recipe_patches(rd)]
+                  local_files = oe.recipeutils.get_recipe_local_files(rd)
+
+                  for key in local_files.copy():
+                        if key.endswith('scc'):
+                              sccfile = open(local_files[key], 'r')
+                              for l in sccfile:
+                                  line = l.split()
+                                  if line and line[0] in ('kconf', 'patch'):
+                                        local_files[line[-1]] = os.path.join(os.path.dirname(local_files[key]), line[-1])
+                                        shutil.copy2(os.path.join(os.path.dirname(local_files[key]), line[-1]), workdir)
+                              sccfile.close()
+
+                  # Ignore local files with subdir={BP}
+                  srcabspath = os.path.abspath(srcsubdir)
+                  local_files = [fname for fname in local_files if os.path.exists(os.path.join(workdir, fname)) and  (srcabspath == workdir or not  os.path.join(workdir, fname).startswith(srcabspath + os.sep))]
+                  if local_files:
+                       for fname in local_files:
+                              copy_src_to_ws(os.path.join(workdir, fname), os.path.join(srctree, 'oe-local-files', fname))
+                       with open(os.path.join(srctree, 'oe-local-files', '.gitignore'), 'w') as f:
+                              f.write('# Ignore local files, by default. Remove this file ''if you want to commit the directory to Git\n*\n')
+
+                  if os.path.abspath(rd.getVar('S')) == os.path.abspath(rd.getVar('WORKDIR')):
+                  # If recipe extracts to ${WORKDIR}, symlink the files into the srctree
+                  # (otherwise the recipe won't build as expected)
+                        local_files_dir = os.path.join(srctree, 'oe-local-files')
+                        addfiles = []
+                        for root, _, files in os.walk(local_files_dir):
+                            relpth = os.path.relpath(root, local_files_dir)
+                            if relpth != '.':
+                                  bb.utils.mkdirhier(os.path.join(srctree, relpth))
+                            for fn in files:
+                                if fn == '.gitignore':
+                                    continue
+                                destpth = os.path.join(srctree, relpth, fn)
+                                if os.path.exists(destpth):
+                                    os.unlink(destpth)
+                                os.symlink('oe-local-files/%s' % fn, destpth)
+                                addfiles.append(os.path.join(relpth, fn))
+                        if addfiles:
+                           bb.process.run('git add %s' % ' '.join(addfiles), cwd=srctree)
+                        useroptions = []
+                        oe.patch.GitApplyTree.gitCommandUserOptions(useroptions, d=d)
+                        bb.process.run('git %s commit -a -m "Committing local file symlinks\n\n%s"' % (' '.join(useroptions), oe.patch.GitApplyTree.ignore_commit_prefix), cwd=srctree)
+
+                  task = 'do_configure'
+                  res = tinfoil.build_targets(pn, task, handle_events=True)
+
+                  # Copy .config to workspace 
+                  kconfpath=rd.getVar('B')
+                  logger.info('Copying kernel config to workspace')
+                  shutil.copy2(os.path.join(kconfpath, '.config'),srctree)
+
+                  # Set this to true, we still need to get initial_rev
+                  # by parsing the git repo
+                  args.no_extract = True
+
         if not args.no_extract:
             initial_rev, _ = _extract_source(srctree, args.keep_temp, args.branch, False, config, basepath, workspace, args.fixed_setup, rd, tinfoil, no_overrides=args.no_overrides)
             if not initial_rev:
@@ -843,10 +957,12 @@ def modify(args, config, basepath, workspace):
                 f.write('\ndo_patch() {\n'
                         '    :\n'
                         '}\n')
-                f.write('\ndo_configure_append() {\n'
-                        '    cp ${B}/.config ${S}/.config.baseline\n'
-                        '    ln -sfT ${B}/.config ${S}/.config.new\n'
-                        '}\n')
+
+            if rd.getVarFlag('do_menuconfig','task'):
+                    f.write('\ndo_configure_append() {\n'
+                    '    cp ${B}/.config ${S}/.config.baseline\n'
+                    '    ln -sfT ${B}/.config ${S}/.config.new\n'
+                    '}\n')
             if initial_rev:
                 f.write('\n# initial_rev: %s\n' % initial_rev)
                 for commit in commits:
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] devtool modify: Create a copy of kernel source
  2018-12-05  0:37 [PATCH 0/3] Devtool: provide easy means of reconfiguring the kernel Sai Hari Chandana Kalluri
  2018-12-05  0:37 ` [PATCH 1/3] devtool modify: Update devtool modify to copy source from work-shared if its already downloaded Sai Hari Chandana Kalluri
@ 2018-12-05  0:37 ` Sai Hari Chandana Kalluri
  2018-12-05  0:37 ` [PATCH 3/3] devtool: provide support for devtool menuconfig command Sai Hari Chandana Kalluri
  2018-12-05 12:33 ` ✗ patchtest: failure for Devtool: provide easy means of reconfiguring the kernel (rev2) Patchwork
  3 siblings, 0 replies; 9+ messages in thread
From: Sai Hari Chandana Kalluri @ 2018-12-05  0:37 UTC (permalink / raw)
  To: openembedded-core; +Cc: Sai Hari Chandana Kalluri

If kernel source is not already downloaded i.e staging kernel dir is
empty, place a copy of the source when the user runs devtool modify linux-yocto.
This way the kernel source is available for other packages that use it.

[YOCTO #10416]

Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com>
Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com>
---
 scripts/lib/devtool/standard.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 3a8222a..06a0619 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -567,7 +567,7 @@ def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, works
         with open(preservestampfile, 'w') as f:
             f.write(d.getVar('STAMP'))
         try:
-            if bb.data.inherits_class('kernel-yocto', d):
+            if is_kernel_yocto:
                 # We need to generate the kernel config
                 task = 'do_configure'
             else:
@@ -594,6 +594,14 @@ def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, works
             raise DevtoolError('Something went wrong with source extraction - the devtool-source class was not active or did not function correctly:\n%s' % str(e))
         srcsubdir_rel = os.path.relpath(srcsubdir, os.path.join(tempdir, 'workdir'))
 
+        # Check if work-shared is empty, if yes 
+        # find source and copy to work-shared
+        if is_kernel_yocto:
+              workshareddir = d.getVar('STAGING_KERNEL_DIR')
+              if os.path.exists(workshareddir) and not os.listdir(workshareddir):
+                   os.rmdir(workshareddir)
+                   copy_src_to_ws(srcsubdir,workshareddir)
+
         tempdir_localdir = os.path.join(tempdir, 'oe-local-files')
         srctree_localdir = os.path.join(srctree, 'oe-local-files')
 
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] devtool: provide support for devtool menuconfig command.
  2018-12-05  0:37 [PATCH 0/3] Devtool: provide easy means of reconfiguring the kernel Sai Hari Chandana Kalluri
  2018-12-05  0:37 ` [PATCH 1/3] devtool modify: Update devtool modify to copy source from work-shared if its already downloaded Sai Hari Chandana Kalluri
  2018-12-05  0:37 ` [PATCH 2/3] devtool modify: Create a copy of kernel source Sai Hari Chandana Kalluri
@ 2018-12-05  0:37 ` Sai Hari Chandana Kalluri
  2018-12-05 12:33 ` ✗ patchtest: failure for Devtool: provide easy means of reconfiguring the kernel (rev2) Patchwork
  3 siblings, 0 replies; 9+ messages in thread
From: Sai Hari Chandana Kalluri @ 2018-12-05  0:37 UTC (permalink / raw)
  To: openembedded-core; +Cc: Sai Hari Chandana Kalluri

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]

Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com>
Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com>
---
 scripts/lib/devtool/menuconfig.py | 80 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 scripts/lib/devtool/menuconfig.py

diff --git a/scripts/lib/devtool/menuconfig.py b/scripts/lib/devtool/menuconfig.py
new file mode 100644
index 0000000..38133db
--- /dev/null
+++ b/scripts/lib/devtool/menuconfig.py
@@ -0,0 +1,80 @@
+# OpenEmbedded Development tool - menuconfig command plugin
+#
+# Copyright (C) 2018 Xilinx
+# Written by: Chandana Kalluri <ckalluri@xilinx.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+"""Devtool menuconfig plugin"""
+
+import os
+import bb
+import logging
+import argparse
+import re
+import glob
+from devtool import setup_tinfoil, parse_recipe, DevtoolError, standard, exec_build_env_command
+
+logger = logging.getLogger('devtool')
+
+def menuconfig(args, config, basepath, workspace):
+    """Entry point for the devtool 'menuconfig' subcommand"""
+
+    rd = "" 
+    kconfigpath = ""
+    pn_src = ""
+    localfilesdir = ""
+    workspace_dir = ""
+    tinfoil = setup_tinfoil(basepath=basepath)
+    try:
+      rd = parse_recipe(config, tinfoil, args.component, appends=True, filter_workspace=False)
+      if not rd:
+         return 1
+
+      pn =  rd.getVar('PN', True)
+      if pn not in workspace:
+         raise DevtoolError("Run devtool modify before calling menuconfig for %s" %pn)
+
+      if not rd.getVarFlag('do_menuconfig','task'):
+         raise DevtoolError("This package does not support menuconfig option")
+
+      workspace_dir = os.path.join(basepath,'workspace/sources')
+      kconfigpath = rd.getVar('B')
+      pn_src = os.path.join(workspace_dir,pn)
+
+      #add check to see if oe_local_files exists or not
+      localfilesdir = os.path.join(pn_src,'oe-local-files') 
+      if not os.path.exists(localfilesdir):
+          bb.utils.mkdirhier(localfilesdir)
+          #Add gitignore to ensure source tree is clean
+          gitignorefile = os.path.join(localfilesdir,'.gitignore')
+          with open(gitignorefile, 'w') as f:
+                  f.write('# Ignore local files, by default. Remove this file if you want to commit the directory to Git\n')
+                  f.write('*\n')
+
+    finally:
+      tinfoil.shutdown()
+
+    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)
+
+    return 0
+
+def register_commands(subparsers, context):
+    """register devtool subcommands from this plugin"""
+    parser_menuconfig = subparsers.add_parser('menuconfig',help='allows altering the system component configuration', description='launches the make menuconfig command, allows user to make changes to configuration. creates a config fragment', group='advanced') 
+    parser_menuconfig.add_argument('component', help='compenent to alter config')
+    parser_menuconfig.set_defaults(func=menuconfig,fixed_setup=context.fixed_setup)
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* ✗ patchtest: failure for Devtool: provide easy means of reconfiguring the kernel (rev2)
  2018-12-05  0:37 [PATCH 0/3] Devtool: provide easy means of reconfiguring the kernel Sai Hari Chandana Kalluri
                   ` (2 preceding siblings ...)
  2018-12-05  0:37 ` [PATCH 3/3] devtool: provide support for devtool menuconfig command Sai Hari Chandana Kalluri
@ 2018-12-05 12:33 ` Patchwork
  3 siblings, 0 replies; 9+ messages in thread
From: Patchwork @ 2018-12-05 12:33 UTC (permalink / raw)
  To: Sai Hari Chandana Kalluri; +Cc: openembedded-core

== Series Details ==

Series: Devtool: provide easy means of reconfiguring the kernel (rev2)
Revision: 2
URL   : https://patchwork.openembedded.org/series/15215/
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            [1/3] devtool modify: Update devtool modify to copy source from work-shared if its already downloaded.
 Issue             Commit shortlog is too long [test_shortlog_length] 
  Suggested fix    Edit shortlog so that it is 90 characters or less (currently 96 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] 9+ messages in thread

* Re: [PATCH 1/3] devtool modify: Update devtool modify to copy source from work-shared if its already downloaded.
  2018-12-05  0:37 ` [PATCH 1/3] devtool modify: Update devtool modify to copy source from work-shared if its already downloaded Sai Hari Chandana Kalluri
@ 2018-12-06 14:23   ` Mittal, Anuj
  0 siblings, 0 replies; 9+ messages in thread
From: Mittal, Anuj @ 2018-12-06 14:23 UTC (permalink / raw)
  To: openembedded-core, chandana.kalluri

I gave this a try and it looks like if I change my kernel version after
one try of devtool modify, this change copies the old kernel version
tree (because something is already present in work-shared). 

And, work-shared is getting re-populated with the requested second
kernel vesion when running do_configure in the same code block later
on.

Thanks,
Anuj

On Tue, 2018-12-04 at 16:37 -0800, Sai Hari Chandana Kalluri wrote:
> In the regular devtool modify flow, the kernel source is fetched by
> running
> do_fetch task. This is an overhead in time and space.
> 
> This patch updates modify command to check if the kernel source is
> already
> downloaded. If so, then instead of calling do_fetch, copy the source
> from
> work-shared to devtool workspace by creating hard links to be more
> efficient.
> Else run the usual devtool modify flow and call do_fetch task.
> 
> [YOCTO #10416]
> 
> Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com
> >
> Signed-off-by: Alejandro Enedino Hernandez Samaniego <
> alejandr@xilinx.com>
> ---
>  scripts/lib/devtool/standard.py | 124
> ++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 120 insertions(+), 4 deletions(-)
> 
> diff --git a/scripts/lib/devtool/standard.py
> b/scripts/lib/devtool/standard.py
> index d14b7a6..3a8222a 100644
> --- a/scripts/lib/devtool/standard.py
> +++ b/scripts/lib/devtool/standard.py
> @@ -712,6 +712,53 @@ def _check_preserve(config, recipename):
>                      tf.write(line)
>      os.rename(newfile, origfile)
>  
> +# Function links a file from src location to dest location
> +def copy_file(c,dest):
> +    import errno
> +    destdir = os.path.dirname(dest)
> +    if os.path.islink(c):
> +       linkto = os.readlink(c)
> +       if os.path.lexists(dest):
> +            if not os.path.islink(dest):
> +                raise OSError(errno.EEXIST, "Link %s already exists
> as a file" % dest, dest)
> +            if os.readlink(dest) == linkto:
> +                return dest
> +            raise OSError(errno.EEXIST, "Link %s already exists to a
> different location? (%s vs %s)" % (dest, os.readlink(dest), linkto),
> dest)
> +       os.symlink(linkto, dest)
> +    else:
> +       try:
> +           os.link(c, dest)
> +       except OSError as err:
> +           if err.errno == errno.EXDEV:
> +                bb.utils.copyfile(c, dest)
> +           else:
> +                raise
> +
> +# Function creates folders in a given target location
> +def copy_dirs(root,dirs,target):
> +    for d in dirs:
> +        destdir =  os.path.join(target,d)
> +        if os.path.islink(os.path.join(root,d)):
> +             linkto = os.readlink(os.path.join(root,d))
> +             os.symlink(linkto,destdir) 
> +        else:
> +             bb.utils.mkdirhier(target+d)
> +
> +# Function to link src dir to dest dir
> +def copy_src_to_ws(srcdir,srctree):
> +    target = srctree
> +    if os.path.exists(target):
> +        raise DevtoolError('source already in your workspace')
> +
> +    bb.utils.mkdirhier(target)
> +    for root,dirs,files in os.walk(srcdir):
> +        #convert abspath to relpath for root
> +        destdir = root.replace(srcdir,"")
> +        target = srctree+destdir+"/"
> +        copy_dirs(root,dirs,target)  
> +        for f in files:
> +           copy_file(os.path.join(root,f),os.path.join(target,f))
> +
>  def modify(args, config, basepath, workspace):
>      """Entry point for the devtool 'modify' subcommand"""
>      import bb
> @@ -758,6 +805,73 @@ def modify(args, config, basepath, workspace):
>          initial_rev = None
>          commits = []
>          check_commits = False
> +
> +        if bb.data.inherits_class('kernel-yocto', rd):
> +               srcdir = rd.getVar('STAGING_KERNEL_DIR')
> +               if os.path.exists(srcdir) and os.listdir(srcdir):
> +                  copy_src_to_ws(srcdir,srctree)
> +
> +                  workdir = rd.getVar('WORKDIR')
> +                  srcsubdir = rd.getVar('S')
> +                  localfilesdir = os.path.join(srctree,'oe-local-
> files') 
> +                  # Move local source files into separate subdir
> +                  recipe_patches = [os.path.basename(patch) for
> patch in oe.recipeutils.get_recipe_patches(rd)]
> +                  local_files =
> oe.recipeutils.get_recipe_local_files(rd)
> +
> +                  for key in local_files.copy():
> +                        if key.endswith('scc'):
> +                              sccfile = open(local_files[key], 'r')
> +                              for l in sccfile:
> +                                  line = l.split()
> +                                  if line and line[0] in ('kconf',
> 'patch'):
> +                                        local_files[line[-1]] =
> os.path.join(os.path.dirname(local_files[key]), line[-1])
> +                                        shutil.copy2(os.path.join(os
> .path.dirname(local_files[key]), line[-1]), workdir)
> +                              sccfile.close()
> +
> +                  # Ignore local files with subdir={BP}
> +                  srcabspath = os.path.abspath(srcsubdir)
> +                  local_files = [fname for fname in local_files if
> os.path.exists(os.path.join(workdir, fname)) and  (srcabspath ==
> workdir or not  os.path.join(workdir, fname).startswith(srcabspath +
> os.sep))]
> +                  if local_files:
> +                       for fname in local_files:
> +                              copy_src_to_ws(os.path.join(workdir,
> fname), os.path.join(srctree, 'oe-local-files', fname))
> +                       with open(os.path.join(srctree, 'oe-local-
> files', '.gitignore'), 'w') as f:
> +                              f.write('# Ignore local files, by
> default. Remove this file ''if you want to commit the directory to
> Git\n*\n')
> +
> +                  if os.path.abspath(rd.getVar('S')) ==
> os.path.abspath(rd.getVar('WORKDIR')):
> +                  # If recipe extracts to ${WORKDIR}, symlink the
> files into the srctree
> +                  # (otherwise the recipe won't build as expected)
> +                        local_files_dir = os.path.join(srctree, 'oe-
> local-files')
> +                        addfiles = []
> +                        for root, _, files in
> os.walk(local_files_dir):
> +                            relpth = os.path.relpath(root,
> local_files_dir)
> +                            if relpth != '.':
> +                                  bb.utils.mkdirhier(os.path.join(sr
> ctree, relpth))
> +                            for fn in files:
> +                                if fn == '.gitignore':
> +                                    continue
> +                                destpth = os.path.join(srctree,
> relpth, fn)
> +                                if os.path.exists(destpth):
> +                                    os.unlink(destpth)
> +                                os.symlink('oe-local-files/%s' % fn,
> destpth)
> +                                addfiles.append(os.path.join(relpth,
> fn))
> +                        if addfiles:
> +                           bb.process.run('git add %s' % '
> '.join(addfiles), cwd=srctree)
> +                        useroptions = []
> +                        oe.patch.GitApplyTree.gitCommandUserOptions(
> useroptions, d=d)
> +                        bb.process.run('git %s commit -a -m
> "Committing local file symlinks\n\n%s"' % (' '.join(useroptions),
> oe.patch.GitApplyTree.ignore_commit_prefix), cwd=srctree)
> +
> +                  task = 'do_configure'
> +                  res = tinfoil.build_targets(pn, task,
> handle_events=True)
> +
> +                  # Copy .config to workspace 
> +                  kconfpath=rd.getVar('B')
> +                  logger.info('Copying kernel config to workspace')
> +                  shutil.copy2(os.path.join(kconfpath,
> '.config'),srctree)
> +
> +                  # Set this to true, we still need to get
> initial_rev
> +                  # by parsing the git repo
> +                  args.no_extract = True
> +
>          if not args.no_extract:
>              initial_rev, _ = _extract_source(srctree,
> args.keep_temp, args.branch, False, config, basepath, workspace,
> args.fixed_setup, rd, tinfoil, no_overrides=args.no_overrides)
>              if not initial_rev:
> @@ -843,10 +957,12 @@ def modify(args, config, basepath, workspace):
>                  f.write('\ndo_patch() {\n'
>                          '    :\n'
>                          '}\n')
> -                f.write('\ndo_configure_append() {\n'
> -                        '    cp ${B}/.config
> ${S}/.config.baseline\n'
> -                        '    ln -sfT ${B}/.config
> ${S}/.config.new\n'
> -                        '}\n')
> +
> +            if rd.getVarFlag('do_menuconfig','task'):
> +                    f.write('\ndo_configure_append() {\n'
> +                    '    cp ${B}/.config ${S}/.config.baseline\n'
> +                    '    ln -sfT ${B}/.config ${S}/.config.new\n'
> +                    '}\n')
>              if initial_rev:
>                  f.write('\n# initial_rev: %s\n' % initial_rev)
>                  for commit in commits:
> -- 
> 2.7.4
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] devtool: provide support for devtool menuconfig command.
  2018-12-05 16:38   ` Scott Rifenbark
@ 2018-12-05 17:26     ` Alejandro Hernandez
  0 siblings, 0 replies; 9+ messages in thread
From: Alejandro Hernandez @ 2018-12-05 17:26 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 7088 bytes --]

Hey Scott,

On 12/5/2018 8:38 AM, Scott Rifenbark wrote:
> Hi,
>
> This probably has documentation ramifications yes?  See 
> https://yoctoproject.org/docs/2.6/mega-manual/mega-manual.html#ref-devtool-reference.


Yup, this should be documented, we can provide you a draft for you to 
review, expect it within the next few days.


Cheers,

Alejandro


>
> Thanks,
> Scott
>
> On Wed, Dec 5, 2018 at 8:27 AM Sai Hari Chandana Kalluri 
> <chandana.kalluri@xilinx.com <mailto:chandana.kalluri@xilinx.com>> wrote:
>
>     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]
>
>     Signed-off-by: Sai Hari Chandana Kalluri
>     <chandana.kalluri@xilinx.com <mailto:chandana.kalluri@xilinx.com>>
>     Signed-off-by: Alejandro Enedino Hernandez Samaniego
>     <alejandr@xilinx.com <mailto:alejandr@xilinx.com>>
>     ---
>      scripts/lib/devtool/menuconfig.py | 80
>     +++++++++++++++++++++++++++++++++++++++
>      1 file changed, 80 insertions(+)
>      create mode 100644 scripts/lib/devtool/menuconfig.py
>
>     diff --git a/scripts/lib/devtool/menuconfig.py
>     b/scripts/lib/devtool/menuconfig.py
>     new file mode 100644
>     index 0000000..38133db
>     --- /dev/null
>     +++ b/scripts/lib/devtool/menuconfig.py
>     @@ -0,0 +1,80 @@
>     +# OpenEmbedded Development tool - menuconfig command plugin
>     +#
>     +# Copyright (C) 2018 Xilinx
>     +# Written by: Chandana Kalluri <ckalluri@xilinx.com
>     <mailto:ckalluri@xilinx.com>>
>     +#
>     +# This program is free software; you can redistribute it and/or
>     modify
>     +# it under the terms of the GNU General Public License version 2 as
>     +# published by the Free Software Foundation.
>     +#
>     +# This program is distributed in the hope that it will be useful,
>     +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>     +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>     +# GNU General Public License for more details.
>     +#
>     +# You should have received a copy of the GNU General Public
>     License along
>     +# with this program; if not, write to the Free Software
>     Foundation, Inc.,
>     +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
>     +
>     +"""Devtool menuconfig plugin"""
>     +
>     +import os
>     +import bb
>     +import logging
>     +import argparse
>     +import re
>     +import glob
>     +from devtool import setup_tinfoil, parse_recipe, DevtoolError,
>     standard, exec_build_env_command
>     +
>     +logger = logging.getLogger('devtool')
>     +
>     +def menuconfig(args, config, basepath, workspace):
>     +    """Entry point for the devtool 'menuconfig' subcommand"""
>     +
>     +    rd = ""
>     +    kconfigpath = ""
>     +    pn_src = ""
>     +    localfilesdir = ""
>     +    workspace_dir = ""
>     +    tinfoil = setup_tinfoil(basepath=basepath)
>     +    try:
>     +      rd = parse_recipe(config, tinfoil, args.component,
>     appends=True, filter_workspace=False)
>     +      if not rd:
>     +         return 1
>     +
>     +      pn =  rd.getVar('PN', True)
>     +      if pn not in workspace:
>     +         raise DevtoolError("Run devtool modify before calling
>     menuconfig for %s" %pn)
>     +
>     +      if not rd.getVarFlag('do_menuconfig','task'):
>     +         raise DevtoolError("This package does not support
>     menuconfig option")
>     +
>     +      workspace_dir = os.path.join(basepath,'workspace/sources')
>     +      kconfigpath = rd.getVar('B')
>     +      pn_src = os.path.join(workspace_dir,pn)
>     +
>     +      #add check to see if oe_local_files exists or not
>     +      localfilesdir = os.path.join(pn_src,'oe-local-files')
>     +      if not os.path.exists(localfilesdir):
>     +          bb.utils.mkdirhier(localfilesdir)
>     +          #Add gitignore to ensure source tree is clean
>     +          gitignorefile = os.path.join(localfilesdir,'.gitignore')
>     +          with open(gitignorefile, 'w') as f:
>     +                  f.write('# Ignore local files, by default.
>     Remove this file if you want to commit the directory to Git\n')
>     +                  f.write('*\n')
>     +
>     +    finally:
>     +      tinfoil.shutdown()
>     +
>     + logger.info <http://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)
>     +
>     +    return 0
>     +
>     +def register_commands(subparsers, context):
>     +    """register devtool subcommands from this plugin"""
>     +    parser_menuconfig =
>     subparsers.add_parser('menuconfig',help='allows altering the
>     system component configuration', description='launches the make
>     menuconfig command, allows user to make changes to configuration.
>     creates a config fragment', group='advanced')
>     +    parser_menuconfig.add_argument('component', help='compenent
>     to alter config')
>     +
>     parser_menuconfig.set_defaults(func=menuconfig,fixed_setup=context.fixed_setup)
>     -- 
>     2.7.4
>
>     -- 
>     _______________________________________________
>     Openembedded-core mailing list
>     Openembedded-core@lists.openembedded.org
>     <mailto:Openembedded-core@lists.openembedded.org>
>     http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
>

[-- Attachment #2: Type: text/html, Size: 10471 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] devtool: provide support for devtool menuconfig command.
  2018-12-04 19:54 ` [PATCH 3/3] devtool: provide support for devtool menuconfig command Sai Hari Chandana Kalluri
@ 2018-12-05 16:38   ` Scott Rifenbark
  2018-12-05 17:26     ` Alejandro Hernandez
  0 siblings, 1 reply; 9+ messages in thread
From: Scott Rifenbark @ 2018-12-05 16:38 UTC (permalink / raw)
  To: chandana.kalluri; +Cc: Eggleton, Paul, openembedded-core

[-- Attachment #1: Type: text/plain, Size: 5873 bytes --]

Hi,

This probably has documentation ramifications yes?  See
https://yoctoproject.org/docs/2.6/mega-manual/mega-manual.html#ref-devtool-reference
.

Thanks,
Scott

On Wed, Dec 5, 2018 at 8:27 AM Sai Hari Chandana Kalluri <
chandana.kalluri@xilinx.com> wrote:

> 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]
>
> Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com>
> Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com>
> ---
>  scripts/lib/devtool/menuconfig.py | 80
> +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 80 insertions(+)
>  create mode 100644 scripts/lib/devtool/menuconfig.py
>
> diff --git a/scripts/lib/devtool/menuconfig.py
> b/scripts/lib/devtool/menuconfig.py
> new file mode 100644
> index 0000000..38133db
> --- /dev/null
> +++ b/scripts/lib/devtool/menuconfig.py
> @@ -0,0 +1,80 @@
> +# OpenEmbedded Development tool - menuconfig command plugin
> +#
> +# Copyright (C) 2018 Xilinx
> +# Written by: Chandana Kalluri <ckalluri@xilinx.com>
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License version 2 as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License along
> +# with this program; if not, write to the Free Software Foundation, Inc.,
> +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
> +
> +"""Devtool menuconfig plugin"""
> +
> +import os
> +import bb
> +import logging
> +import argparse
> +import re
> +import glob
> +from devtool import setup_tinfoil, parse_recipe, DevtoolError, standard,
> exec_build_env_command
> +
> +logger = logging.getLogger('devtool')
> +
> +def menuconfig(args, config, basepath, workspace):
> +    """Entry point for the devtool 'menuconfig' subcommand"""
> +
> +    rd = ""
> +    kconfigpath = ""
> +    pn_src = ""
> +    localfilesdir = ""
> +    workspace_dir = ""
> +    tinfoil = setup_tinfoil(basepath=basepath)
> +    try:
> +      rd = parse_recipe(config, tinfoil, args.component, appends=True,
> filter_workspace=False)
> +      if not rd:
> +         return 1
> +
> +      pn =  rd.getVar('PN', True)
> +      if pn not in workspace:
> +         raise DevtoolError("Run devtool modify before calling menuconfig
> for %s" %pn)
> +
> +      if not rd.getVarFlag('do_menuconfig','task'):
> +         raise DevtoolError("This package does not support menuconfig
> option")
> +
> +      workspace_dir = os.path.join(basepath,'workspace/sources')
> +      kconfigpath = rd.getVar('B')
> +      pn_src = os.path.join(workspace_dir,pn)
> +
> +      #add check to see if oe_local_files exists or not
> +      localfilesdir = os.path.join(pn_src,'oe-local-files')
> +      if not os.path.exists(localfilesdir):
> +          bb.utils.mkdirhier(localfilesdir)
> +          #Add gitignore to ensure source tree is clean
> +          gitignorefile = os.path.join(localfilesdir,'.gitignore')
> +          with open(gitignorefile, 'w') as f:
> +                  f.write('# Ignore local files, by default. Remove this
> file if you want to commit the directory to Git\n')
> +                  f.write('*\n')
> +
> +    finally:
> +      tinfoil.shutdown()
> +
> +    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)
> +
> +    return 0
> +
> +def register_commands(subparsers, context):
> +    """register devtool subcommands from this plugin"""
> +    parser_menuconfig = subparsers.add_parser('menuconfig',help='allows
> altering the system component configuration', description='launches the
> make menuconfig command, allows user to make changes to configuration.
> creates a config fragment', group='advanced')
> +    parser_menuconfig.add_argument('component', help='compenent to alter
> config')
> +
> parser_menuconfig.set_defaults(func=menuconfig,fixed_setup=context.fixed_setup)
> --
> 2.7.4
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>

[-- Attachment #2: Type: text/html, Size: 7485 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 3/3] devtool: provide support for devtool menuconfig command.
  2018-12-04 19:54 [PATCH 0/3] Devtool: provide easy means of reconfiguring the kernel Sai Hari Chandana Kalluri
@ 2018-12-04 19:54 ` Sai Hari Chandana Kalluri
  2018-12-05 16:38   ` Scott Rifenbark
  0 siblings, 1 reply; 9+ messages in thread
From: Sai Hari Chandana Kalluri @ 2018-12-04 19:54 UTC (permalink / raw)
  To: openembedded-core; +Cc: Sai Hari Chandana Kalluri

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]

Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com>
Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com>
---
 scripts/lib/devtool/menuconfig.py | 80 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 scripts/lib/devtool/menuconfig.py

diff --git a/scripts/lib/devtool/menuconfig.py b/scripts/lib/devtool/menuconfig.py
new file mode 100644
index 0000000..38133db
--- /dev/null
+++ b/scripts/lib/devtool/menuconfig.py
@@ -0,0 +1,80 @@
+# OpenEmbedded Development tool - menuconfig command plugin
+#
+# Copyright (C) 2018 Xilinx
+# Written by: Chandana Kalluri <ckalluri@xilinx.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+"""Devtool menuconfig plugin"""
+
+import os
+import bb
+import logging
+import argparse
+import re
+import glob
+from devtool import setup_tinfoil, parse_recipe, DevtoolError, standard, exec_build_env_command
+
+logger = logging.getLogger('devtool')
+
+def menuconfig(args, config, basepath, workspace):
+    """Entry point for the devtool 'menuconfig' subcommand"""
+
+    rd = "" 
+    kconfigpath = ""
+    pn_src = ""
+    localfilesdir = ""
+    workspace_dir = ""
+    tinfoil = setup_tinfoil(basepath=basepath)
+    try:
+      rd = parse_recipe(config, tinfoil, args.component, appends=True, filter_workspace=False)
+      if not rd:
+         return 1
+
+      pn =  rd.getVar('PN', True)
+      if pn not in workspace:
+         raise DevtoolError("Run devtool modify before calling menuconfig for %s" %pn)
+
+      if not rd.getVarFlag('do_menuconfig','task'):
+         raise DevtoolError("This package does not support menuconfig option")
+
+      workspace_dir = os.path.join(basepath,'workspace/sources')
+      kconfigpath = rd.getVar('B')
+      pn_src = os.path.join(workspace_dir,pn)
+
+      #add check to see if oe_local_files exists or not
+      localfilesdir = os.path.join(pn_src,'oe-local-files') 
+      if not os.path.exists(localfilesdir):
+          bb.utils.mkdirhier(localfilesdir)
+          #Add gitignore to ensure source tree is clean
+          gitignorefile = os.path.join(localfilesdir,'.gitignore')
+          with open(gitignorefile, 'w') as f:
+                  f.write('# Ignore local files, by default. Remove this file if you want to commit the directory to Git\n')
+                  f.write('*\n')
+
+    finally:
+      tinfoil.shutdown()
+
+    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)
+
+    return 0
+
+def register_commands(subparsers, context):
+    """register devtool subcommands from this plugin"""
+    parser_menuconfig = subparsers.add_parser('menuconfig',help='allows altering the system component configuration', description='launches the make menuconfig command, allows user to make changes to configuration. creates a config fragment', group='advanced') 
+    parser_menuconfig.add_argument('component', help='compenent to alter config')
+    parser_menuconfig.set_defaults(func=menuconfig,fixed_setup=context.fixed_setup)
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-12-06 14:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-05  0:37 [PATCH 0/3] Devtool: provide easy means of reconfiguring the kernel Sai Hari Chandana Kalluri
2018-12-05  0:37 ` [PATCH 1/3] devtool modify: Update devtool modify to copy source from work-shared if its already downloaded Sai Hari Chandana Kalluri
2018-12-06 14:23   ` Mittal, Anuj
2018-12-05  0:37 ` [PATCH 2/3] devtool modify: Create a copy of kernel source Sai Hari Chandana Kalluri
2018-12-05  0:37 ` [PATCH 3/3] devtool: provide support for devtool menuconfig command Sai Hari Chandana Kalluri
2018-12-05 12:33 ` ✗ patchtest: failure for Devtool: provide easy means of reconfiguring the kernel (rev2) Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2018-12-04 19:54 [PATCH 0/3] Devtool: provide easy means of reconfiguring the kernel Sai Hari Chandana Kalluri
2018-12-04 19:54 ` [PATCH 3/3] devtool: provide support for devtool menuconfig command Sai Hari Chandana Kalluri
2018-12-05 16:38   ` Scott Rifenbark
2018-12-05 17:26     ` Alejandro Hernandez

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.