diff options
author | Aníbal Limón <anibal.limon@linux.intel.com> | 2017-03-20 17:33:25 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-22 11:35:22 +0000 |
commit | 4703aa2b3ba25f463826f9f6eb38b69fa649b572 (patch) | |
tree | f2863f45c607b48e6cab1a6022ef13f3f1b76fee | |
parent | 995cb88233a1bfcf1d83ec21b47f430d0b39f7c3 (diff) | |
download | poky-4703aa2b3ba25f463826f9f6eb38b69fa649b572.tar.gz |
scripts/yocto-compat-layer.py: Add option to disable layer autodiscovery
Sometimes there is a need to only analyze the layer specified by the
command line, the new option -n will disable autodiscovery of layers
and only will try to test specified layers.
(From OE-Core rev: f2f6f0c938226802163698ef14a8a9103da362a0)
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | scripts/lib/compatlayer/__init__.py | 17 | ||||
-rwxr-xr-x | scripts/yocto-compat-layer.py | 4 |
2 files changed, 15 insertions, 6 deletions
diff --git a/scripts/lib/compatlayer/__init__.py b/scripts/lib/compatlayer/__init__.py index 15dc95da1f..b8ce771319 100644 --- a/scripts/lib/compatlayer/__init__.py +++ b/scripts/lib/compatlayer/__init__.py | |||
@@ -108,20 +108,27 @@ def _detect_layer(layer_path): | |||
108 | 108 | ||
109 | return layer | 109 | return layer |
110 | 110 | ||
111 | def detect_layers(layer_directories): | 111 | def detect_layers(layer_directories, no_auto): |
112 | layers = [] | 112 | layers = [] |
113 | 113 | ||
114 | for directory in layer_directories: | 114 | for directory in layer_directories: |
115 | if directory[-1] == '/': | 115 | if directory[-1] == '/': |
116 | directory = directory[0:-1] | 116 | directory = directory[0:-1] |
117 | 117 | ||
118 | for root, dirs, files in os.walk(directory): | 118 | if no_auto: |
119 | dir_name = os.path.basename(root) | 119 | conf_dir = os.path.join(directory, 'conf') |
120 | conf_dir = os.path.join(root, 'conf') | ||
121 | if os.path.isdir(conf_dir): | 120 | if os.path.isdir(conf_dir): |
122 | layer = _detect_layer(root) | 121 | layer = _detect_layer(directory) |
123 | if layer: | 122 | if layer: |
124 | layers.append(layer) | 123 | layers.append(layer) |
124 | else: | ||
125 | for root, dirs, files in os.walk(directory): | ||
126 | dir_name = os.path.basename(root) | ||
127 | conf_dir = os.path.join(root, 'conf') | ||
128 | if os.path.isdir(conf_dir): | ||
129 | layer = _detect_layer(root) | ||
130 | if layer: | ||
131 | layers.append(layer) | ||
125 | 132 | ||
126 | return layers | 133 | return layers |
127 | 134 | ||
diff --git a/scripts/yocto-compat-layer.py b/scripts/yocto-compat-layer.py index b96f3ca0bf..b4de84a0a5 100755 --- a/scripts/yocto-compat-layer.py +++ b/scripts/yocto-compat-layer.py | |||
@@ -47,6 +47,8 @@ def main(): | |||
47 | help='Layer to test compatibility with Yocto Project') | 47 | help='Layer to test compatibility with Yocto Project') |
48 | parser.add_argument('-o', '--output-log', | 48 | parser.add_argument('-o', '--output-log', |
49 | help='File to output log (optional)', action='store') | 49 | help='File to output log (optional)', action='store') |
50 | parser.add_argument('-n', '--no-auto', help='Disable auto layer discovery', | ||
51 | action='store_true') | ||
50 | parser.add_argument('-d', '--debug', help='Enable debug output', | 52 | parser.add_argument('-d', '--debug', help='Enable debug output', |
51 | action='store_true') | 53 | action='store_true') |
52 | parser.add_argument('-q', '--quiet', help='Print only errors', | 54 | parser.add_argument('-q', '--quiet', help='Print only errors', |
@@ -74,7 +76,7 @@ def main(): | |||
74 | builddir = os.environ['BUILDDIR'] | 76 | builddir = os.environ['BUILDDIR'] |
75 | bblayersconf = os.path.join(builddir, 'conf', 'bblayers.conf') | 77 | bblayersconf = os.path.join(builddir, 'conf', 'bblayers.conf') |
76 | 78 | ||
77 | layers = detect_layers(args.layers) | 79 | layers = detect_layers(args.layers, args.no_auto) |
78 | if not layers: | 80 | if not layers: |
79 | logger.error("Fail to detect layers") | 81 | logger.error("Fail to detect layers") |
80 | return 1 | 82 | return 1 |