diff options
author | Amanda Brindle <amanda.r.brindle@intel.com> | 2017-11-20 16:40:25 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-12-02 11:25:32 +0000 |
commit | 4af421a469c4dc1d3c78b58474ce75441e8bc65b (patch) | |
tree | 947e20a3a80c7eb7960007a144ee6c51c09d10f4 /scripts/contrib/bbvars.py | |
parent | 6e181f94d6497f40cd4134b9b815df82519b2e32 (diff) | |
download | poky-4af421a469c4dc1d3c78b58474ce75441e8bc65b.tar.gz |
scripts/contrib/bbvars.py: Remove dead code
Removed the -m option since this script now searches through all
recipes in the configuration. Also removed dead code, which includes
the functions recipe_bbvars() and collect_bbvars().
(From OE-Core rev: dac6515fcd23ea9cde5308c1d08a7a928efbb4d6)
Signed-off-by: Amanda Brindle <amanda.r.brindle@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/contrib/bbvars.py')
-rwxr-xr-x | scripts/contrib/bbvars.py | 52 |
1 files changed, 2 insertions, 50 deletions
diff --git a/scripts/contrib/bbvars.py b/scripts/contrib/bbvars.py index 556f6529f8..286b5a9405 100755 --- a/scripts/contrib/bbvars.py +++ b/scripts/contrib/bbvars.py | |||
@@ -32,48 +32,12 @@ scriptpath.add_bitbake_lib_path() | |||
32 | import bb.tinfoil | 32 | import bb.tinfoil |
33 | 33 | ||
34 | def usage(): | 34 | def usage(): |
35 | print('Usage: %s -d FILENAME [-d FILENAME]* -m METADIR [-m MATADIR]*' % os.path.basename(sys.argv[0])) | 35 | print('Usage: %s -d FILENAME [-d FILENAME]*' % os.path.basename(sys.argv[0])) |
36 | print(' -d FILENAME documentation file to search') | 36 | print(' -d FILENAME documentation file to search') |
37 | print(' -h, --help display this help and exit') | 37 | print(' -h, --help display this help and exit') |
38 | print(' -m METADIR meta directory to search for recipes') | ||
39 | print(' -t FILENAME documentation config file (for doc tags)') | 38 | print(' -t FILENAME documentation config file (for doc tags)') |
40 | print(' -T Only display variables with doc tags (requires -t)') | 39 | print(' -T Only display variables with doc tags (requires -t)') |
41 | 40 | ||
42 | def recipe_bbvars(recipe): | ||
43 | ''' Return a unique set of every bbvar encountered in the recipe ''' | ||
44 | prog = re.compile("[A-Z_]+") | ||
45 | vset = set() | ||
46 | try: | ||
47 | r = open(recipe) | ||
48 | except IOError as err: | ||
49 | print('WARNING: Failed to open recipe ', recipe) | ||
50 | print(err.args[1]) | ||
51 | |||
52 | for line in r: | ||
53 | # Strip any comments from the line | ||
54 | line = line.rsplit('#')[0] | ||
55 | vset = vset.union(set(prog.findall(line))) | ||
56 | r.close() | ||
57 | |||
58 | bbvars = {} | ||
59 | for v in vset: | ||
60 | bbvars[v] = 1 | ||
61 | |||
62 | return bbvars | ||
63 | |||
64 | def collect_bbvars(metadir): | ||
65 | ''' Walk the metadir and collect the bbvars from each recipe found ''' | ||
66 | bbvars = {} | ||
67 | for root,dirs,files in os.walk(metadir): | ||
68 | for name in files: | ||
69 | if name.find(".bb") >= 0: | ||
70 | for key in recipe_bbvars(os.path.join(root,name)).keys(): | ||
71 | if key in bbvars: | ||
72 | bbvars[key] = bbvars[key] + 1 | ||
73 | else: | ||
74 | bbvars[key] = 1 | ||
75 | return bbvars | ||
76 | |||
77 | def bbvar_is_documented(var, documented_vars): | 41 | def bbvar_is_documented(var, documented_vars): |
78 | ''' Check if variable (var) is in the list of documented variables(documented_vars) ''' | 42 | ''' Check if variable (var) is in the list of documented variables(documented_vars) ''' |
79 | if var in documented_vars: | 43 | if var in documented_vars: |
@@ -112,7 +76,6 @@ def bbvar_doctag(var, docconf): | |||
112 | 76 | ||
113 | def main(): | 77 | def main(): |
114 | docfiles = [] | 78 | docfiles = [] |
115 | metadirs = [] | ||
116 | bbvars = set() | 79 | bbvars = set() |
117 | undocumented = [] | 80 | undocumented = [] |
118 | docconf = "" | 81 | docconf = "" |
@@ -136,12 +99,6 @@ def main(): | |||
136 | else: | 99 | else: |
137 | print('ERROR: documentation file %s is not a regular file' % a) | 100 | print('ERROR: documentation file %s is not a regular file' % a) |
138 | sys.exit(3) | 101 | sys.exit(3) |
139 | elif o == '-m': | ||
140 | if os.path.isdir(a): | ||
141 | metadirs.append(a) | ||
142 | else: | ||
143 | print('ERROR: meta directory %s is not a directory' % a) | ||
144 | sys.exit(4) | ||
145 | elif o == "-t": | 102 | elif o == "-t": |
146 | if os.path.isfile(a): | 103 | if os.path.isfile(a): |
147 | docconf = a | 104 | docconf = a |
@@ -155,11 +112,6 @@ def main(): | |||
155 | usage() | 112 | usage() |
156 | sys.exit(5) | 113 | sys.exit(5) |
157 | 114 | ||
158 | if len(metadirs) == 0: | ||
159 | print('ERROR: no metadir specified') | ||
160 | usage() | ||
161 | sys.exit(6) | ||
162 | |||
163 | if onlydoctags and docconf == "": | 115 | if onlydoctags and docconf == "": |
164 | print('ERROR: no docconf specified') | 116 | print('ERROR: no docconf specified') |
165 | usage() | 117 | usage() |
@@ -196,7 +148,7 @@ def main(): | |||
196 | bbvars_update(data) | 148 | bbvars_update(data) |
197 | 149 | ||
198 | # Collect variables from all recipes | 150 | # Collect variables from all recipes |
199 | for recipe in tinfoil.all_recipe_files(): | 151 | for recipe in tinfoil.all_recipe_files(variants=False): |
200 | print("Checking %s" % recipe) | 152 | print("Checking %s" % recipe) |
201 | for data in tinfoil.parse_recipe_file(recipe): | 153 | for data in tinfoil.parse_recipe_file(recipe): |
202 | bbvars_update(data) | 154 | bbvars_update(data) |