summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bblayers/query.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bblayers/query.py')
-rw-r--r--bitbake/lib/bblayers/query.py60
1 files changed, 37 insertions, 23 deletions
diff --git a/bitbake/lib/bblayers/query.py b/bitbake/lib/bblayers/query.py
index f5e3c84747..bfc18a7593 100644
--- a/bitbake/lib/bblayers/query.py
+++ b/bitbake/lib/bblayers/query.py
@@ -1,4 +1,6 @@
1# 1#
2# Copyright BitBake Contributors
3#
2# SPDX-License-Identifier: GPL-2.0-only 4# SPDX-License-Identifier: GPL-2.0-only
3# 5#
4 6
@@ -27,12 +29,12 @@ class QueryPlugin(LayerPlugin):
27 29
28 def do_show_layers(self, args): 30 def do_show_layers(self, args):
29 """show current configured layers.""" 31 """show current configured layers."""
30 logger.plain("%s %s %s" % ("layer".ljust(20), "path".ljust(40), "priority")) 32 logger.plain("%s %s %s" % ("layer".ljust(20), "path".ljust(70), "priority"))
31 logger.plain('=' * 74) 33 logger.plain('=' * 104)
32 for layer, _, regex, pri in self.tinfoil.cooker.bbfile_config_priorities: 34 for layer, _, regex, pri in self.tinfoil.cooker.bbfile_config_priorities:
33 layerdir = self.bbfile_collections.get(layer, None) 35 layerdir = self.bbfile_collections.get(layer, None)
34 layername = self.get_layer_name(layerdir) 36 layername = layer
35 logger.plain("%s %s %d" % (layername.ljust(20), layerdir.ljust(40), pri)) 37 logger.plain("%s %s %s" % (layername.ljust(20), layerdir.ljust(70), pri))
36 38
37 def version_str(self, pe, pv, pr = None): 39 def version_str(self, pe, pv, pr = None):
38 verstr = "%s" % pv 40 verstr = "%s" % pv
@@ -55,11 +57,12 @@ are overlayed will also be listed, with a " (skipped)" suffix.
55 # Check for overlayed .bbclass files 57 # Check for overlayed .bbclass files
56 classes = collections.defaultdict(list) 58 classes = collections.defaultdict(list)
57 for layerdir in self.bblayers: 59 for layerdir in self.bblayers:
58 classdir = os.path.join(layerdir, 'classes') 60 for c in ["classes-global", "classes-recipe", "classes"]:
59 if os.path.exists(classdir): 61 classdir = os.path.join(layerdir, c)
60 for classfile in os.listdir(classdir): 62 if os.path.exists(classdir):
61 if os.path.splitext(classfile)[1] == '.bbclass': 63 for classfile in os.listdir(classdir):
62 classes[classfile].append(classdir) 64 if os.path.splitext(classfile)[1] == '.bbclass':
65 classes[classfile].append(classdir)
63 66
64 # Locating classes and other files is a bit more complicated than recipes - 67 # Locating classes and other files is a bit more complicated than recipes -
65 # layer priority is not a factor; instead BitBake uses the first matching 68 # layer priority is not a factor; instead BitBake uses the first matching
@@ -122,13 +125,18 @@ skipped recipes will also be listed, with a " (skipped)" suffix.
122 if inherits: 125 if inherits:
123 bbpath = str(self.tinfoil.config_data.getVar('BBPATH')) 126 bbpath = str(self.tinfoil.config_data.getVar('BBPATH'))
124 for classname in inherits: 127 for classname in inherits:
125 classfile = 'classes/%s.bbclass' % classname 128 found = False
126 if not bb.utils.which(bbpath, classfile, history=False): 129 for c in ["classes-global", "classes-recipe", "classes"]:
127 logger.error('No class named %s found in BBPATH', classfile) 130 cfile = c + '/%s.bbclass' % classname
131 if bb.utils.which(bbpath, cfile, history=False):
132 found = True
133 break
134 if not found:
135 logger.error('No class named %s found in BBPATH', classname)
128 sys.exit(1) 136 sys.exit(1)
129 137
130 pkg_pn = self.tinfoil.cooker.recipecaches[mc].pkg_pn 138 pkg_pn = self.tinfoil.cooker.recipecaches[mc].pkg_pn
131 (latest_versions, preferred_versions) = self.tinfoil.find_providers(mc) 139 (latest_versions, preferred_versions, required_versions) = self.tinfoil.find_providers(mc)
132 allproviders = self.tinfoil.get_all_providers(mc) 140 allproviders = self.tinfoil.get_all_providers(mc)
133 141
134 # Ensure we list skipped recipes 142 # Ensure we list skipped recipes
@@ -154,7 +162,7 @@ skipped recipes will also be listed, with a " (skipped)" suffix.
154 def print_item(f, pn, ver, layer, ispref): 162 def print_item(f, pn, ver, layer, ispref):
155 if not selected_layer or layer == selected_layer: 163 if not selected_layer or layer == selected_layer:
156 if not bare and f in skiplist: 164 if not bare and f in skiplist:
157 skipped = ' (skipped)' 165 skipped = ' (skipped: %s)' % self.tinfoil.cooker.skiplist[f].skipreason
158 else: 166 else:
159 skipped = '' 167 skipped = ''
160 if show_filenames: 168 if show_filenames:
@@ -172,7 +180,7 @@ skipped recipes will also be listed, with a " (skipped)" suffix.
172 logger.plain(" %s %s%s", layer.ljust(20), ver, skipped) 180 logger.plain(" %s %s%s", layer.ljust(20), ver, skipped)
173 181
174 global_inherit = (self.tinfoil.config_data.getVar('INHERIT') or "").split() 182 global_inherit = (self.tinfoil.config_data.getVar('INHERIT') or "").split()
175 cls_re = re.compile('classes/') 183 cls_re = re.compile('classes.*/')
176 184
177 preffiles = [] 185 preffiles = []
178 show_unique_pn = [] 186 show_unique_pn = []
@@ -274,7 +282,10 @@ Lists recipes with the bbappends that apply to them as subitems.
274 else: 282 else:
275 logger.plain('=== Appended recipes ===') 283 logger.plain('=== Appended recipes ===')
276 284
277 pnlist = list(self.tinfoil.cooker_data.pkg_pn.keys()) 285
286 cooker_data = self.tinfoil.cooker.recipecaches[args.mc]
287
288 pnlist = list(cooker_data.pkg_pn.keys())
278 pnlist.sort() 289 pnlist.sort()
279 appends = False 290 appends = False
280 for pn in pnlist: 291 for pn in pnlist:
@@ -287,7 +298,7 @@ Lists recipes with the bbappends that apply to them as subitems.
287 if not found: 298 if not found:
288 continue 299 continue
289 300
290 if self.show_appends_for_pn(pn): 301 if self.show_appends_for_pn(pn, cooker_data, args.mc):
291 appends = True 302 appends = True
292 303
293 if not args.pnspec and self.show_appends_for_skipped(): 304 if not args.pnspec and self.show_appends_for_skipped():
@@ -296,8 +307,10 @@ Lists recipes with the bbappends that apply to them as subitems.
296 if not appends: 307 if not appends:
297 logger.plain('No append files found') 308 logger.plain('No append files found')
298 309
299 def show_appends_for_pn(self, pn): 310 def show_appends_for_pn(self, pn, cooker_data, mc):
300 filenames = self.tinfoil.cooker_data.pkg_pn[pn] 311 filenames = cooker_data.pkg_pn[pn]
312 if mc:
313 pn = "mc:%s:%s" % (mc, pn)
301 314
302 best = self.tinfoil.find_best_provider(pn) 315 best = self.tinfoil.find_best_provider(pn)
303 best_filename = os.path.basename(best[3]) 316 best_filename = os.path.basename(best[3])
@@ -405,7 +418,7 @@ NOTE: .bbappend files can impact the dependencies.
405 self.check_cross_depends("RRECOMMENDS", layername, f, best, args.filenames, ignore_layers) 418 self.check_cross_depends("RRECOMMENDS", layername, f, best, args.filenames, ignore_layers)
406 419
407 # The inherit class 420 # The inherit class
408 cls_re = re.compile('classes/') 421 cls_re = re.compile('classes.*/')
409 if f in self.tinfoil.cooker_data.inherits: 422 if f in self.tinfoil.cooker_data.inherits:
410 inherits = self.tinfoil.cooker_data.inherits[f] 423 inherits = self.tinfoil.cooker_data.inherits[f]
411 for cls in inherits: 424 for cls in inherits:
@@ -441,10 +454,10 @@ NOTE: .bbappend files can impact the dependencies.
441 line = fnfile.readline() 454 line = fnfile.readline()
442 455
443 # The "require/include xxx" in conf/machine/*.conf, .inc and .bbclass 456 # The "require/include xxx" in conf/machine/*.conf, .inc and .bbclass
444 conf_re = re.compile(".*/conf/machine/[^\/]*\.conf$") 457 conf_re = re.compile(r".*/conf/machine/[^\/]*\.conf$")
445 inc_re = re.compile(".*\.inc$") 458 inc_re = re.compile(r".*\.inc$")
446 # The "inherit xxx" in .bbclass 459 # The "inherit xxx" in .bbclass
447 bbclass_re = re.compile(".*\.bbclass$") 460 bbclass_re = re.compile(r".*\.bbclass$")
448 for layerdir in self.bblayers: 461 for layerdir in self.bblayers:
449 layername = self.get_layer_name(layerdir) 462 layername = self.get_layer_name(layerdir)
450 for dirpath, dirnames, filenames in os.walk(layerdir): 463 for dirpath, dirnames, filenames in os.walk(layerdir):
@@ -522,6 +535,7 @@ NOTE: .bbappend files can impact the dependencies.
522 535
523 parser_show_appends = self.add_command(sp, 'show-appends', self.do_show_appends) 536 parser_show_appends = self.add_command(sp, 'show-appends', self.do_show_appends)
524 parser_show_appends.add_argument('pnspec', nargs='*', help='optional recipe name specification (wildcards allowed, enclose in quotes to avoid shell expansion)') 537 parser_show_appends.add_argument('pnspec', nargs='*', help='optional recipe name specification (wildcards allowed, enclose in quotes to avoid shell expansion)')
538 parser_show_appends.add_argument('--mc', help='use specified multiconfig', default='')
525 539
526 parser_show_cross_depends = self.add_command(sp, 'show-cross-depends', self.do_show_cross_depends) 540 parser_show_cross_depends = self.add_command(sp, 'show-cross-depends', self.do_show_cross_depends)
527 parser_show_cross_depends.add_argument('-f', '--filenames', help='show full file path', action='store_true') 541 parser_show_cross_depends.add_argument('-f', '--filenames', help='show full file path', action='store_true')