All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] checklayer: Avoid adding the layer if it is already present
@ 2019-02-12 10:16 Robert Yang
  2019-02-12 10:16 ` [PATCH 1/2] yocto-check-layer-wrapper: Fix path for oe-init-build-env Robert Yang
  2019-02-12 10:16 ` [PATCH 2/2] checklayer: Avoid adding the layer if it is already present Robert Yang
  0 siblings, 2 replies; 3+ messages in thread
From: Robert Yang @ 2019-02-12 10:16 UTC (permalink / raw)
  To: openembedded-core

The following changes since commit 2dbbf598192ae2b3aa488df042f56aa6c6634a00:

  oe-build-perf-report: Fix missing buildstats comparisions (2019-02-11 17:46:04 +0000)

are available in the git repository at:

  git://git.openembedded.org/openembedded-core-contrib rbt/check
  http://cgit.openembedded.org/openembedded-core-contrib/log/?h=rbt/check

Robert Yang (2):
  yocto-check-layer-wrapper: Fix path for oe-init-build-env
  checklayer: Avoid adding the layer if it is already present

 scripts/lib/checklayer/__init__.py | 36 +++++++++++++++++-------------------
 scripts/yocto-check-layer          |  6 +++---
 scripts/yocto-check-layer-wrapper  |  4 +++-
 3 files changed, 23 insertions(+), 23 deletions(-)

-- 
2.7.4



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

* [PATCH 1/2] yocto-check-layer-wrapper: Fix path for oe-init-build-env
  2019-02-12 10:16 [PATCH 0/2] checklayer: Avoid adding the layer if it is already present Robert Yang
@ 2019-02-12 10:16 ` Robert Yang
  2019-02-12 10:16 ` [PATCH 2/2] checklayer: Avoid adding the layer if it is already present Robert Yang
  1 sibling, 0 replies; 3+ messages in thread
From: Robert Yang @ 2019-02-12 10:16 UTC (permalink / raw)
  To: openembedded-core

We only could run it in top of oe-core dir since it assumed oe-init-build-env
was in cwd, this patch fixes the problem.

[YOCTO #13148]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 scripts/yocto-check-layer-wrapper | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/yocto-check-layer-wrapper b/scripts/yocto-check-layer-wrapper
index bbf6ee1..b5df9ce 100755
--- a/scripts/yocto-check-layer-wrapper
+++ b/scripts/yocto-check-layer-wrapper
@@ -30,7 +30,9 @@ cd $base_dir
 
 build_dir=$(mktemp -p $base_dir -d -t build-XXXX)
 
-source oe-init-build-env $build_dir
+this_dir=$(dirname $(readlink -f $0))
+
+source $this_dir/../oe-init-build-env $build_dir
 if [[ $output_log != '' ]]; then
 	yocto-check-layer -o "$output_log" "$*"
 else
-- 
2.7.4



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

* [PATCH 2/2] checklayer: Avoid adding the layer if it is already present
  2019-02-12 10:16 [PATCH 0/2] checklayer: Avoid adding the layer if it is already present Robert Yang
  2019-02-12 10:16 ` [PATCH 1/2] yocto-check-layer-wrapper: Fix path for oe-init-build-env Robert Yang
@ 2019-02-12 10:16 ` Robert Yang
  1 sibling, 0 replies; 3+ messages in thread
From: Robert Yang @ 2019-02-12 10:16 UTC (permalink / raw)
  To: openembedded-core

* Rename add_layer() to add_layers() so that add_layer_dependencies() can
  re-use it.

* Avoid adding the layer if it is already present

[YOCTO #13148]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 scripts/lib/checklayer/__init__.py | 36 +++++++++++++++++-------------------
 scripts/yocto-check-layer          |  6 +++---
 2 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/scripts/lib/checklayer/__init__.py b/scripts/lib/checklayer/__init__.py
index ca7863a..670f0ee 100644
--- a/scripts/lib/checklayer/__init__.py
+++ b/scripts/lib/checklayer/__init__.py
@@ -196,31 +196,29 @@ def add_layer_dependencies(bblayersconf, layer, layers, logger):
     if layer_depends is None:
         return False
     else:
-        # Don't add a layer that is already present.
-        added = set()
-        output = check_command('Getting existing layers failed.', 'bitbake-layers show-layers').decode('utf-8')
-        for layer, path, pri in re.findall(r'^(\S+) +([^\n]*?) +(\d+)$', output, re.MULTILINE):
-            added.add(path)
-
-        for layer_depend in layer_depends:
-            name = layer_depend['name']
-            path = layer_depend['path']
+        add_layers(bblayersconf, layer_depends, logger)
+
+    return True
+
+def add_layers(bblayersconf, layers, logger):
+    # Don't add a layer that is already present.
+    added = set()
+    output = check_command('Getting existing layers failed.', 'bitbake-layers show-layers').decode('utf-8')
+    for layer, path, pri in re.findall(r'^(\S+) +([^\n]*?) +(\d+)$', output, re.MULTILINE):
+        added.add(path)
+
+    with open(bblayersconf, 'a+') as f:
+        for layer in layers:
+            logger.info('Adding layer %s' % layer['name'])
+            name = layer['name']
+            path = layer['path']
             if path in added:
-                continue
+                logger.info('%s is already in %s' % (name, bblayersconf))
             else:
                 added.add(path)
-            logger.info('Adding layer dependency %s' % name)
-            with open(bblayersconf, 'a+') as f:
                 f.write("\nBBLAYERS += \"%s\"\n" % path)
     return True
 
-def add_layer(bblayersconf, layer, layers, logger):
-    logger.info('Adding layer %s' % layer['name'])
-    with open(bblayersconf, 'a+') as f:
-        f.write("\nBBLAYERS += \"%s\"\n" % layer['path'])
-
-    return True
-
 def check_command(error_msg, cmd, cwd=None):
     '''
     Run a command under a shell, capture stdout and stderr in a single stream,
diff --git a/scripts/yocto-check-layer b/scripts/yocto-check-layer
index 9b7e536..106c955 100755
--- a/scripts/yocto-check-layer
+++ b/scripts/yocto-check-layer
@@ -22,7 +22,7 @@ import scriptpath
 scriptpath.add_oe_lib_path()
 scriptpath.add_bitbake_lib_path()
 
-from checklayer import LayerType, detect_layers, add_layer, add_layer_dependencies, get_signatures
+from checklayer import LayerType, detect_layers, add_layers, add_layer_dependencies, get_signatures
 from oeqa.utils.commands import get_bb_vars
 
 PROGNAME = 'yocto-check-layer'
@@ -157,7 +157,7 @@ def main():
             layers_tested = layers_tested + 1
             continue
 
-        if any(map(lambda additional_layer: not add_layer(bblayersconf, additional_layer, dep_layers, logger),
+        if any(map(lambda additional_layer: not add_layers(bblayersconf, [additional_layer], logger),
                    additional_layers)):
             logger.info('Skipping %s due to missing additional layers.' % layer['name'])
             results[layer['name']] = None
@@ -179,7 +179,7 @@ def main():
             continue
         td['machines'] = args.machines
 
-        if not add_layer(bblayersconf, layer, dep_layers, logger):
+        if not add_layers(bblayersconf, [layer], logger):
             logger.info('Skipping %s ???.' % layer['name'])
             results[layer['name']] = None
             results_status[layer['name']] = 'SKIPPED (Unknown)'
-- 
2.7.4



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

end of thread, other threads:[~2019-02-12  9:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-12 10:16 [PATCH 0/2] checklayer: Avoid adding the layer if it is already present Robert Yang
2019-02-12 10:16 ` [PATCH 1/2] yocto-check-layer-wrapper: Fix path for oe-init-build-env Robert Yang
2019-02-12 10:16 ` [PATCH 2/2] checklayer: Avoid adding the layer if it is already present Robert Yang

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.