All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] devtool build
@ 2015-09-01  6:13 leonardo.sandoval.gonzalez
  2015-09-01  6:13 ` [PATCH 1/2] devtool: Create a single file for the build devtool feature leonardo.sandoval.gonzalez
  2015-09-01  6:13 ` [PATCH 2/2] devtool: Allow disabling make parallelism on build command leonardo.sandoval.gonzalez
  0 siblings, 2 replies; 3+ messages in thread
From: leonardo.sandoval.gonzalez @ 2015-09-01  6:13 UTC (permalink / raw)
  To: openembedded-core; +Cc: paul.eggleton

From: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>

First patch moves all the build related code from standard.py to build.py,
and second patch includes the --disable-parallel-make parameter, which
as the name indicates, removes parallelism on the make tool.

The following changes since commit 22afc047dd1b8f83e56c4a9862710776c509e3c5:

  oe-selftest: test devtool build-image plugin (2015-08-31 11:37:14 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib lsandov1/devtool-disable-parallelism
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=lsandov1/devtool-disable-parallelism

Leonardo Sandoval (2):
  devtool: Create a single file for the build devtool feature
  devtool: Allow disabling make parallelism on build command

 scripts/lib/devtool/build.py    | 75 +++++++++++++++++++++++++++++++++++++++++
 scripts/lib/devtool/standard.py | 22 ------------
 2 files changed, 75 insertions(+), 22 deletions(-)
 create mode 100644 scripts/lib/devtool/build.py

-- 
1.8.4.5



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

* [PATCH 1/2] devtool: Create a single file for the build devtool feature
  2015-09-01  6:13 [PATCH 0/2] devtool build leonardo.sandoval.gonzalez
@ 2015-09-01  6:13 ` leonardo.sandoval.gonzalez
  2015-09-01  6:13 ` [PATCH 2/2] devtool: Allow disabling make parallelism on build command leonardo.sandoval.gonzalez
  1 sibling, 0 replies; 3+ messages in thread
From: leonardo.sandoval.gonzalez @ 2015-09-01  6:13 UTC (permalink / raw)
  To: openembedded-core; +Cc: paul.eggleton

From: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>

The intention is to have a single file for each devtool feature
so devtool can grow in a modular way. In this direction, this patch creates
build.py, moving all related build features from standard.py to build.py.

Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
---
 scripts/lib/devtool/build.py    | 50 +++++++++++++++++++++++++++++++++++++++++
 scripts/lib/devtool/standard.py | 22 ------------------
 2 files changed, 50 insertions(+), 22 deletions(-)
 create mode 100644 scripts/lib/devtool/build.py

diff --git a/scripts/lib/devtool/build.py b/scripts/lib/devtool/build.py
new file mode 100644
index 0000000..0f848e2
--- /dev/null
+++ b/scripts/lib/devtool/build.py
@@ -0,0 +1,50 @@
+# Development tool - build command plugin
+#
+# Copyright (C) 2014-2015 Intel Corporation
+#
+# 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 build plugin"""
+
+import logging
+import argparse
+from devtool import exec_build_env_command
+
+logger = logging.getLogger('devtool')
+
+def plugin_init(pluginlist):
+    """Plugin initialization"""
+    pass
+
+def build(args, config, basepath, workspace):
+    """Entry point for the devtool 'build' subcommand"""
+    import bb
+    if not args.recipename in workspace:
+        raise DevtoolError("no recipe named %s in your workspace" %
+                           args.recipename)
+    build_task = config.get('Build', 'build_task', 'populate_sysroot')
+    try:
+        exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s' % (build_task, args.recipename), watch=True)
+    except bb.process.ExecutionError as e:
+        # We've already seen the output since watch=True, so just ensure we return something to the user
+        return e.exitcode
+
+    return 0
+
+def register_commands(subparsers, context):
+    """Register devtool subcommands from this plugin"""
+    parser_build = subparsers.add_parser('build', help='Build a recipe',
+                                         description='Builds the specified recipe using bitbake',
+                                         formatter_class=argparse.ArgumentDefaultsHelpFormatter)
+    parser_build.add_argument('recipename', help='Recipe to build')
+    parser_build.set_defaults(func=build)
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index de7afd9..ad14769 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -822,22 +822,6 @@ def reset(args, config, basepath, workspace):
     return 0
 
 
-def build(args, config, basepath, workspace):
-    """Entry point for the devtool 'build' subcommand"""
-    import bb
-    if not args.recipename in workspace:
-        raise DevtoolError("no recipe named %s in your workspace" %
-                           args.recipename)
-    build_task = config.get('Build', 'build_task', 'populate_sysroot')
-    try:
-        exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s' % (build_task, args.recipename), watch=True)
-    except bb.process.ExecutionError as e:
-        # We've already seen the output since watch=True, so just ensure we return something to the user
-        return e.exitcode
-
-    return 0
-
-
 def register_commands(subparsers, context):
     """Register devtool subcommands from this plugin"""
     parser_add = subparsers.add_parser('add', help='Add a new recipe',
@@ -886,12 +870,6 @@ def register_commands(subparsers, context):
                                           formatter_class=argparse.ArgumentDefaultsHelpFormatter)
     parser_status.set_defaults(func=status)
 
-    parser_build = subparsers.add_parser('build', help='Build a recipe',
-                                         description='Builds the specified recipe using bitbake',
-                                         formatter_class=argparse.ArgumentDefaultsHelpFormatter)
-    parser_build.add_argument('recipename', help='Recipe to build')
-    parser_build.set_defaults(func=build)
-
     parser_reset = subparsers.add_parser('reset', help='Remove a recipe from your workspace',
                                          description='Removes the specified recipe from your workspace (resetting its state)',
                                          formatter_class=argparse.ArgumentDefaultsHelpFormatter)
-- 
1.8.4.5



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

* [PATCH 2/2] devtool: Allow disabling make parallelism on build command
  2015-09-01  6:13 [PATCH 0/2] devtool build leonardo.sandoval.gonzalez
  2015-09-01  6:13 ` [PATCH 1/2] devtool: Create a single file for the build devtool feature leonardo.sandoval.gonzalez
@ 2015-09-01  6:13 ` leonardo.sandoval.gonzalez
  1 sibling, 0 replies; 3+ messages in thread
From: leonardo.sandoval.gonzalez @ 2015-09-01  6:13 UTC (permalink / raw)
  To: openembedded-core; +Cc: paul.eggleton

From: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>

Through --disable-parallel-make, the user can turn off parallelism
on the make tool. This can be useful when debuging race conditions issues.
A POSTFILE is created under 'build/conf' for further usage. So far, the
file just clears the PARALLEL_MAKE variable. The postfile can be used with
bitbake, including it with the '-R' parameter.

[YOCTO #7589]

Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
---
 scripts/lib/devtool/build.py | 31 ++++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)

diff --git a/scripts/lib/devtool/build.py b/scripts/lib/devtool/build.py
index 0f848e2..9faff27 100644
--- a/scripts/lib/devtool/build.py
+++ b/scripts/lib/devtool/build.py
@@ -16,9 +16,12 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 """Devtool build plugin"""
 
+import os
+import bb
 import logging
 import argparse
-from devtool import exec_build_env_command
+import tempfile
+from devtool import exec_build_env_command, DevtoolError
 
 logger = logging.getLogger('devtool')
 
@@ -26,18 +29,39 @@ def plugin_init(pluginlist):
     """Plugin initialization"""
     pass
 
+def _create_conf_file(values, conf_file=None):
+    if not conf_file:
+        fd, conf_file = tempfile.mkstemp(suffix='.conf')
+    elif not os.path.exists(os.path.dirname(conf_file)):
+        logger.info("Creating folder %s" % os.path.dirname(conf_file))
+        bb.utils.mkdirhier(os.path.dirname(conf_file))
+    with open(conf_file,'w') as f:
+        for key, value in values.iteritems():
+            f.write('%s="%s"\n' % (key,value))
+    return conf_file
+
 def build(args, config, basepath, workspace):
     """Entry point for the devtool 'build' subcommand"""
-    import bb
     if not args.recipename in workspace:
         raise DevtoolError("no recipe named %s in your workspace" %
                            args.recipename)
+
     build_task = config.get('Build', 'build_task', 'populate_sysroot')
+
+    postfile_param = postfile = ""
+    if args.disable_parallel_make:
+        logger.info("Disabling 'make' parallelism")
+        postfile = os.path.join(basepath,'conf','disable_parallelism.conf')
+        _create_conf_file({'PARALLEL_MAKE':''}, postfile)
+        postfile_param = "-R %s" % postfile
     try:
-        exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s' % (build_task, args.recipename), watch=True)
+        exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s %s' % (build_task, postfile_param, args.recipename), watch=True)
     except bb.process.ExecutionError as e:
         # We've already seen the output since watch=True, so just ensure we return something to the user
         return e.exitcode
+    finally:
+        if args.disable_parallel_make:
+            logger.info("POSTFILE placed on %s" % postfile)
 
     return 0
 
@@ -47,4 +71,5 @@ def register_commands(subparsers, context):
                                          description='Builds the specified recipe using bitbake',
                                          formatter_class=argparse.ArgumentDefaultsHelpFormatter)
     parser_build.add_argument('recipename', help='Recipe to build')
+    parser_build.add_argument('--disable-parallel-make', action="store_true", help='Disable make parallelism')
     parser_build.set_defaults(func=build)
-- 
1.8.4.5



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

end of thread, other threads:[~2015-09-01 14:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-01  6:13 [PATCH 0/2] devtool build leonardo.sandoval.gonzalez
2015-09-01  6:13 ` [PATCH 1/2] devtool: Create a single file for the build devtool feature leonardo.sandoval.gonzalez
2015-09-01  6:13 ` [PATCH 2/2] devtool: Allow disabling make parallelism on build command leonardo.sandoval.gonzalez

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.