1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
import collections
import fnmatch
import logging
import sys
import os
import re
import bb.utils
from bbsetup.common import SetupPlugin
import layers.layerindex
logger = logging.getLogger('BitBake.BBSetup.query')
def plugin_init(plugins):
return QueryPlugin()
class QueryPlugin(SetupPlugin):
def do_query(self, args):
"""Query the layer index"""
lindex = layers.layerindex.LayerIndex(self.data)
loadMask = ""
if args.layerdependencies:
loadMask += " layerDependencies"
if args.recipes:
loadMask += " recipes"
if args.machines:
loadMask += " machines"
if args.distros:
loadMask += " distros"
lindex.load_layerindex(self.data.getVar('BBLAYERINDEX_URI'), load=loadMask)
if args.distros:
lindex.list_obj('distros')
if args.machines:
lindex.list_obj('machines')
if args.branches:
lindex.list_obj('branches')
if args.layers:
lindex.list_obj('layerItems')
if args.layerbranches:
lindex.list_obj('layerBranches')
if args.layerdependencies:
lindex.list_obj('layerDependencies')
if args.recipes:
lindex.list_obj('recipes')
#lindex.store_layerindex('file:///tmp/wr-index;type=restapi', lindex.lindex[0])
#lindex.store_layerindex('file:///tmp/oe-index;type=restapi', lindex.lindex[1])
#lindex.store_layerindex('file:///tmp/test-api.json;type=restapi', lindex.lindex[0])
def register_commands(self, sp):
query = self.add_command(sp, 'query', self.do_query)
query.add_argument('--distros', help='List all available distro values', action='store_true')
query.add_argument('--machines', help='List all available machine values', action='store_true')
query.add_argument('--branches', help='List all available branch values', action='store_true')
query.add_argument('--layers', help='List all available layers', action='store_true')
query.add_argument('--layerbranches', help='List all available layerbranches', action='store_true')
query.add_argument('--layerdependencies', help='List all available layerdependencies', action='store_true')
query.add_argument('--recipes', help='List all available recipe values', action='store_true')
|