summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2019-06-27 11:14:55 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-28 13:28:37 +0100
commitdc3b7bd2eb31c32443811466aa32e0d58d969f8a (patch)
treed14a87656ca4bfe8fa092136a72d34dead45e788 /scripts
parent0df6cef5258ccd6bd137279aa610b6b1bce43640 (diff)
downloadpoky-dc3b7bd2eb31c32443811466aa32e0d58d969f8a.tar.gz
devtool: warn user about multiple layer having the same base name
Currently `devtool finish RECIPE meta' will silently succeed even if there are multiple layers having the same base name of 'meta'. e.g. meta layer from oe-core and meta layer from meta-secure-core. We should at least give user a warning in such case. With the patch, we will get warning like below. WARNING: Multiple layers have the same base name 'meta', use the first one '<PROJ_DIR>/oe-core/meta'. WARNING: Consider using path instead of base name to specify layer: <PROJ_DIR>/oe-core/meta <PROJ_DIR>/meta-secure-core/meta (From OE-Core rev: 2c8740f543c38dbaef3345e40827ef48b3f75405) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/devtool/standard.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index aca74b1fc6..47ed531b03 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -1866,13 +1866,27 @@ def reset(args, config, basepath, workspace):
1866def _get_layer(layername, d): 1866def _get_layer(layername, d):
1867 """Determine the base layer path for the specified layer name/path""" 1867 """Determine the base layer path for the specified layer name/path"""
1868 layerdirs = d.getVar('BBLAYERS').split() 1868 layerdirs = d.getVar('BBLAYERS').split()
1869 layers = {os.path.basename(p): p for p in layerdirs} 1869 layers = {} # {basename: layer_paths}
1870 for p in layerdirs:
1871 bn = os.path.basename(p)
1872 if bn not in layers:
1873 layers[bn] = [p]
1874 else:
1875 layers[bn].append(p)
1870 # Provide some shortcuts 1876 # Provide some shortcuts
1871 if layername.lower() in ['oe-core', 'openembedded-core']: 1877 if layername.lower() in ['oe-core', 'openembedded-core']:
1872 layerdir = layers.get('meta', None) 1878 layername = 'meta'
1879 layer_paths = layers.get(layername, None)
1880 if not layer_paths:
1881 return os.path.abspath(layername)
1882 elif len(layer_paths) == 1:
1883 return os.path.abspath(layer_paths[0])
1873 else: 1884 else:
1874 layerdir = layers.get(layername, None) 1885 # multiple layers having the same base name
1875 return os.path.abspath(layerdir or layername) 1886 logger.warning("Multiple layers have the same base name '%s', use the first one '%s'." % (layername, layer_paths[0]))
1887 logger.warning("Consider using path instead of base name to specify layer:\n\t\t%s" % '\n\t\t'.join(layer_paths))
1888 return os.path.abspath(layer_paths[0])
1889
1876 1890
1877def finish(args, config, basepath, workspace): 1891def finish(args, config, basepath, workspace):
1878 """Entry point for the devtool 'finish' subcommand""" 1892 """Entry point for the devtool 'finish' subcommand"""