diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2012-01-30 16:25:54 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-02-01 15:08:42 +0000 |
commit | 90e99a5caefcfd53c9c2780382432df7550f2d2b (patch) | |
tree | 8333106a2ff791f04e1108d4abe46979c02d5b99 /bitbake | |
parent | 86a5fcd2c62585152fabc271b8e7893fe31399a9 (diff) | |
download | poky-90e99a5caefcfd53c9c2780382432df7550f2d2b.tar.gz |
bitbake-layers: list overlayed classes in show-overlayed
Classes (.bbclass files) can be overlayed in a layer although they are
currently located by BitBake in a different way (via BBPATH instead of
using layer priority) and thus it is useful to be able to see when this
is in effect and which layer's class is actually being used.
(Bitbake rev: f6493e4bad005a82580380d800ebf4c438292f5b)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rwxr-xr-x | bitbake/bin/bitbake-layers | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/bitbake/bin/bitbake-layers b/bitbake/bin/bitbake-layers index bf5bf9b53d..70894e60e1 100755 --- a/bitbake/bin/bitbake-layers +++ b/bitbake/bin/bitbake-layers | |||
@@ -162,6 +162,53 @@ Options: | |||
162 | 162 | ||
163 | items_listed = self.list_recipes('Overlayed recipes', None, True, show_same_ver_only, show_filenames, True) | 163 | items_listed = self.list_recipes('Overlayed recipes', None, True, show_same_ver_only, show_filenames, True) |
164 | 164 | ||
165 | # Check for overlayed .bbclass files | ||
166 | classes = defaultdict(list) | ||
167 | for layerdir in self.bblayers: | ||
168 | classdir = os.path.join(layerdir, 'classes') | ||
169 | if os.path.exists(classdir): | ||
170 | for classfile in os.listdir(classdir): | ||
171 | if os.path.splitext(classfile)[1] == '.bbclass': | ||
172 | classes[classfile].append(classdir) | ||
173 | |||
174 | # Locating classes and other files is a bit more complicated than recipes - | ||
175 | # layer priority is not a factor; instead BitBake uses the first matching | ||
176 | # file in BBPATH, which is manipulated directly by each layer's | ||
177 | # conf/layer.conf in turn, thus the order of layers in bblayers.conf is a | ||
178 | # factor - however, each layer.conf is free to either prepend or append to | ||
179 | # BBPATH (or indeed do crazy stuff with it). Thus the order in BBPATH might | ||
180 | # not be exactly the order present in bblayers.conf either. | ||
181 | bbpath = str(self.config_data.getVar('BBPATH', True)) | ||
182 | overlayed_class_found = False | ||
183 | for (classfile, classdirs) in classes.items(): | ||
184 | if len(classdirs) > 1: | ||
185 | if not overlayed_class_found: | ||
186 | logger.plain('=== Overlayed classes ===') | ||
187 | overlayed_class_found = True | ||
188 | |||
189 | mainfile = bb.utils.which(bbpath, os.path.join('classes', classfile)) | ||
190 | if show_filenames: | ||
191 | logger.plain('%s' % mainfile) | ||
192 | else: | ||
193 | # We effectively have to guess the layer here | ||
194 | logger.plain('%s:' % classfile) | ||
195 | mainlayername = '?' | ||
196 | for layerdir in self.bblayers: | ||
197 | classdir = os.path.join(layerdir, 'classes') | ||
198 | if mainfile.startswith(classdir): | ||
199 | mainlayername = self.get_layer_name(layerdir) | ||
200 | logger.plain(' %s' % mainlayername) | ||
201 | for classdir in classdirs: | ||
202 | fullpath = os.path.join(classdir, classfile) | ||
203 | if fullpath != mainfile: | ||
204 | if show_filenames: | ||
205 | print(' %s' % fullpath) | ||
206 | else: | ||
207 | print(' %s' % self.get_layer_name(os.path.dirname(classdir))) | ||
208 | |||
209 | if overlayed_class_found: | ||
210 | items_listed = True; | ||
211 | |||
165 | if not items_listed: | 212 | if not items_listed: |
166 | logger.note('No overlayed files found') | 213 | logger.note('No overlayed files found') |
167 | 214 | ||