summaryrefslogtreecommitdiffstats
path: root/bitbake/bin/bitbake-layers
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/bin/bitbake-layers')
-rwxr-xr-xbitbake/bin/bitbake-layers116
1 files changed, 105 insertions, 11 deletions
diff --git a/bitbake/bin/bitbake-layers b/bitbake/bin/bitbake-layers
index 65496b1674..151f87fd52 100755
--- a/bitbake/bin/bitbake-layers
+++ b/bitbake/bin/bitbake-layers
@@ -9,6 +9,7 @@ import logging
9import os 9import os
10import sys 10import sys
11import fnmatch 11import fnmatch
12from collections import defaultdict
12 13
13bindir = os.path.dirname(__file__) 14bindir = os.path.dirname(__file__)
14topdir = os.path.dirname(bindir) 15topdir = os.path.dirname(bindir)
@@ -121,22 +122,115 @@ class Commands(cmd.Cmd):
121 122
122 logger.plain("%s %s %d" % (layername.ljust(20), layerdir.ljust(40), layerpri)) 123 logger.plain("%s %s %d" % (layername.ljust(20), layerdir.ljust(40), layerpri))
123 124
125
126 def version_str(self, pe, pv, pr = None):
127 verstr = "%s" % pv
128 if pr:
129 verstr = "%s-%s" % (verstr, pr)
130 if pe:
131 verstr = "%s:%s" % (pe, verstr)
132 return verstr
133
134
124 def do_show_overlayed(self, args): 135 def do_show_overlayed(self, args):
125 """list overlayed recipes (where there is a recipe in another layer that has a higher layer priority) 136 """list overlayed recipes (where the same recipe exists in another layer that has a higher layer priority)
137
138usage: show-overlayed [-f] [-s]
126 139
127usage: show-overlayed 140Lists the names of overlayed recipes and the available versions in each
141layer, with the preferred version first. Note that skipped recipes that
142are overlayed will also be listed, with a " (skipped)" suffix.
128 143
129Highest priority recipes are listed with the recipes they overlay as subitems. 144Options:
145 -f instead of the default formatting, list filenames of higher priority
146 recipes with the ones they overlay indented underneath
147 -s only list overlayed recipes where the version is the same
130""" 148"""
131 self.check_prepare_cooker() 149 self.check_prepare_cooker()
132 if self.cooker.overlayed: 150
133 logger.plain('Overlayed recipes:') 151 show_filenames = False
134 for f in self.cooker.overlayed.iterkeys(): 152 show_same_ver_only = False
135 logger.plain('%s' % f) 153 for arg in args.split():
136 for of in self.cooker.overlayed[f]: 154 if arg == '-f':
137 logger.plain(' %s' % of) 155 show_filenames = True
138 else: 156 elif arg == '-s':
139 logger.plain('No overlayed recipes found') 157 show_same_ver_only = True
158 else:
159 sys.stderr.write("show-overlayed: invalid option %s\n" % arg)
160 self.do_help('')
161 return
162
163 pkg_pn = self.cooker.status.pkg_pn
164 (latest_versions, preferred_versions) = bb.providers.findProviders(self.cooker.configuration.data, self.cooker.status, pkg_pn)
165 allproviders = bb.providers.allProviders(self.cooker.status)
166
167 # Ensure we list skipped recipes
168 # We are largely guessing about PN, PV and the preferred version here,
169 # but we have no choice since skipped recipes are not fully parsed
170 skiplist = self.cooker.skiplist.keys()
171 skiplist.sort( key=lambda fileitem: self.cooker.calc_bbfile_priority(fileitem) )
172 skiplist.reverse()
173 for fn in skiplist:
174 recipe_parts = os.path.splitext(os.path.basename(fn))[0].split('_')
175 p = recipe_parts[0]
176 if len(recipe_parts) > 1:
177 ver = (None, recipe_parts[1], None)
178 else:
179 ver = (None, 'unknown', None)
180 allproviders[p].append((ver, fn))
181 if not p in pkg_pn:
182 pkg_pn[p] = 'dummy'
183 preferred_versions[p] = (ver, fn)
184
185 def print_item(f, pn, ver, layer, ispref):
186 if f in skiplist:
187 skipped = ' (skipped)'
188 else:
189 skipped = ''
190 if show_filenames:
191 if ispref:
192 logger.plain("%s%s", f, skipped)
193 else:
194 logger.plain(" %s%s", f, skipped)
195 else:
196 if ispref:
197 logger.plain("%s:", pn)
198 logger.plain(" %s %s%s", layer.ljust(20), ver, skipped)
199
200 preffiles = []
201 items_listed = False
202 for p in sorted(pkg_pn):
203 if len(allproviders[p]) > 1:
204 pref = preferred_versions[p]
205 preffile = bb.cache.Cache.virtualfn2realfn(pref[1])[0]
206 if preffile not in preffiles:
207 preflayer = self.get_file_layer(preffile)
208 multilayer = False
209 same_ver = True
210 provs = []
211 for prov in allproviders[p]:
212 provfile = bb.cache.Cache.virtualfn2realfn(prov[1])[0]
213 provlayer = self.get_file_layer(provfile)
214 provs.append((provfile, provlayer, prov[0]))
215 if provlayer != preflayer:
216 multilayer = True
217 if prov[0] != pref[0]:
218 same_ver = False
219
220 if multilayer and (same_ver or not show_same_ver_only):
221 if not items_listed:
222 logger.plain('=== Overlayed recipes ===')
223 items_listed = True
224 print_item(preffile, p, self.version_str(pref[0][0], pref[0][1]), preflayer, True)
225 for (provfile, provlayer, provver) in provs:
226 if provfile != preffile:
227 print_item(provfile, p, self.version_str(provver[0], provver[1]), provlayer, False)
228 # Ensure we don't show two entries for BBCLASSEXTENDed recipes
229 preffiles.append(preffile)
230
231 if not items_listed:
232 logger.note('No overlayed files found')
233
140 234
141 def do_flatten(self, args): 235 def do_flatten(self, args):
142 """flattens layer configuration into a separate output directory. 236 """flattens layer configuration into a separate output directory.