summaryrefslogtreecommitdiffstats
path: root/bitbake/bin
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-01-30 16:25:53 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-02-01 15:08:42 +0000
commit86a5fcd2c62585152fabc271b8e7893fe31399a9 (patch)
tree2f7a2773bca67495d7708f846b4b88b63e5f2570 /bitbake/bin
parent526264e7d74c8b5fad4ab5ec3303b2edfea98e61 (diff)
downloadpoky-86a5fcd2c62585152fabc271b8e7893fe31399a9.tar.gz
bitbake-layers: add show-recipes subcommand
Add a show-recipes subcommand which lists all available recipes, with the layer they are provided by. You can optionally filter the output by recipe name (PN). (This is a generalised version of the show-overlayed subcommand.) (Bitbake rev: 05e86ba966f5a26721891c82b21afa48768a67cc) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin')
-rwxr-xr-xbitbake/bin/bitbake-layers57
1 files changed, 52 insertions, 5 deletions
diff --git a/bitbake/bin/bitbake-layers b/bitbake/bin/bitbake-layers
index 151f87fd52..bf5bf9b53d 100755
--- a/bitbake/bin/bitbake-layers
+++ b/bitbake/bin/bitbake-layers
@@ -160,6 +160,50 @@ Options:
160 self.do_help('') 160 self.do_help('')
161 return 161 return
162 162
163 items_listed = self.list_recipes('Overlayed recipes', None, True, show_same_ver_only, show_filenames, True)
164
165 if not items_listed:
166 logger.note('No overlayed files found')
167
168
169 def do_show_recipes(self, args):
170 """list available recipes, showing the layer they are provided by
171
172usage: show-recipes [-f] [-m] [pnspec]
173
174Lists the names of overlayed recipes and the available versions in each
175layer, with the preferred version first. Optionally you may specify
176pnspec to match a specified recipe name (supports wildcards). Note that
177skipped recipes will also be listed, with a " (skipped)" suffix.
178
179Options:
180 -f instead of the default formatting, list filenames of higher priority
181 recipes with other available recipes indented underneath
182 -m only list where multiple recipes (in the same layer or different
183 layers) exist for the same recipe name
184"""
185 self.check_prepare_cooker()
186
187 show_filenames = False
188 show_multi_provider_only = False
189 pnspec = None
190 title = 'Available recipes:'
191 for arg in args.split():
192 if arg == '-f':
193 show_filenames = True
194 elif arg == '-m':
195 show_multi_provider_only = True
196 elif not arg.startswith('-'):
197 pnspec = arg
198 title = 'Available recipes matching %s:' % pnspec
199 else:
200 sys.stderr.write("show-recipes: invalid option %s\n" % arg)
201 self.do_help('')
202 return
203 self.list_recipes(title, pnspec, False, False, show_filenames, show_multi_provider_only)
204
205
206 def list_recipes(self, title, pnspec, show_overlayed_only, show_same_ver_only, show_filenames, show_multi_provider_only):
163 pkg_pn = self.cooker.status.pkg_pn 207 pkg_pn = self.cooker.status.pkg_pn
164 (latest_versions, preferred_versions) = bb.providers.findProviders(self.cooker.configuration.data, self.cooker.status, pkg_pn) 208 (latest_versions, preferred_versions) = bb.providers.findProviders(self.cooker.configuration.data, self.cooker.status, pkg_pn)
165 allproviders = bb.providers.allProviders(self.cooker.status) 209 allproviders = bb.providers.allProviders(self.cooker.status)
@@ -200,7 +244,11 @@ Options:
200 preffiles = [] 244 preffiles = []
201 items_listed = False 245 items_listed = False
202 for p in sorted(pkg_pn): 246 for p in sorted(pkg_pn):
203 if len(allproviders[p]) > 1: 247 if pnspec:
248 if not fnmatch.fnmatch(p, pnspec):
249 continue
250
251 if len(allproviders[p]) > 1 or not show_multi_provider_only:
204 pref = preferred_versions[p] 252 pref = preferred_versions[p]
205 preffile = bb.cache.Cache.virtualfn2realfn(pref[1])[0] 253 preffile = bb.cache.Cache.virtualfn2realfn(pref[1])[0]
206 if preffile not in preffiles: 254 if preffile not in preffiles:
@@ -217,9 +265,9 @@ Options:
217 if prov[0] != pref[0]: 265 if prov[0] != pref[0]:
218 same_ver = False 266 same_ver = False
219 267
220 if multilayer and (same_ver or not show_same_ver_only): 268 if (multilayer or not show_overlayed_only) and (same_ver or not show_same_ver_only):
221 if not items_listed: 269 if not items_listed:
222 logger.plain('=== Overlayed recipes ===') 270 logger.plain('=== %s ===' % title)
223 items_listed = True 271 items_listed = True
224 print_item(preffile, p, self.version_str(pref[0][0], pref[0][1]), preflayer, True) 272 print_item(preffile, p, self.version_str(pref[0][0], pref[0][1]), preflayer, True)
225 for (provfile, provlayer, provver) in provs: 273 for (provfile, provlayer, provver) in provs:
@@ -228,8 +276,7 @@ Options:
228 # Ensure we don't show two entries for BBCLASSEXTENDed recipes 276 # Ensure we don't show two entries for BBCLASSEXTENDed recipes
229 preffiles.append(preffile) 277 preffiles.append(preffile)
230 278
231 if not items_listed: 279 return items_listed
232 logger.note('No overlayed files found')
233 280
234 281
235 def do_flatten(self, args): 282 def do_flatten(self, args):