summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-10-11 19:27:44 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-12-01 21:32:04 +0000
commit74505b42956e6dec31436f56db13c1dfc2d8892a (patch)
treec2ca65d546f737251eff4cb9d32f5b047e4d28fd /scripts
parent3f46af2b1923cbfd3af0b8ce3c360eb34f316dfc (diff)
downloadpoky-74505b42956e6dec31436f56db13c1dfc2d8892a.tar.gz
devtool: search: print SUMMARY value
Print the SUMMARY value for each matched item assuming it's not the default. (From OE-Core rev: 596dee8882ebddb45a6cce9f12aa919107106156) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/devtool/search.py77
1 files changed, 42 insertions, 35 deletions
diff --git a/scripts/lib/devtool/search.py b/scripts/lib/devtool/search.py
index 1c8eaff49b..2ea446237e 100644
--- a/scripts/lib/devtool/search.py
+++ b/scripts/lib/devtool/search.py
@@ -22,53 +22,60 @@ import bb
22import logging 22import logging
23import argparse 23import argparse
24import re 24import re
25from devtool import setup_tinfoil, DevtoolError 25from devtool import setup_tinfoil, parse_recipe, DevtoolError
26 26
27logger = logging.getLogger('devtool') 27logger = logging.getLogger('devtool')
28 28
29def search(args, config, basepath, workspace): 29def search(args, config, basepath, workspace):
30 """Entry point for the devtool 'search' subcommand""" 30 """Entry point for the devtool 'search' subcommand"""
31 31
32 tinfoil = setup_tinfoil(config_only=True, basepath=basepath) 32 tinfoil = setup_tinfoil(config_only=False, basepath=basepath)
33 pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR', True) 33 try:
34 tinfoil.shutdown() 34 pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR', True)
35 defsummary = tinfoil.config_data.getVar('SUMMARY', False) or ''
35 36
36 keyword_rc = re.compile(args.keyword) 37 keyword_rc = re.compile(args.keyword)
37 38
38 for fn in os.listdir(pkgdata_dir): 39 for fn in os.listdir(pkgdata_dir):
39 pfn = os.path.join(pkgdata_dir, fn) 40 pfn = os.path.join(pkgdata_dir, fn)
40 if not os.path.isfile(pfn): 41 if not os.path.isfile(pfn):
41 continue 42 continue
42 43
43 packages = [] 44 packages = []
44 match = False 45 match = False
45 if keyword_rc.search(fn): 46 if keyword_rc.search(fn):
46 match = True 47 match = True
47 48
48 if not match: 49 if not match:
49 with open(pfn, 'r') as f: 50 with open(pfn, 'r') as f:
50 for line in f: 51 for line in f:
51 if line.startswith('PACKAGES:'): 52 if line.startswith('PACKAGES:'):
52 packages = line.split(':', 1)[1].strip().split() 53 packages = line.split(':', 1)[1].strip().split()
53 54
54 for pkg in packages: 55 for pkg in packages:
55 if keyword_rc.search(pkg): 56 if keyword_rc.search(pkg):
56 match = True 57 match = True
57 break 58 break
58 if os.path.exists(os.path.join(pkgdata_dir, 'runtime', pkg + '.packaged')): 59 if os.path.exists(os.path.join(pkgdata_dir, 'runtime', pkg + '.packaged')):
59 with open(os.path.join(pkgdata_dir, 'runtime', pkg), 'r') as f: 60 with open(os.path.join(pkgdata_dir, 'runtime', pkg), 'r') as f:
60 for line in f: 61 for line in f:
61 if ': ' in line: 62 if ': ' in line:
62 splitline = line.split(':', 1) 63 splitline = line.split(':', 1)
63 key = splitline[0] 64 key = splitline[0]
64 value = splitline[1].strip() 65 value = splitline[1].strip()
65 if key in ['PKG_%s' % pkg, 'DESCRIPTION', 'FILES_INFO'] or key.startswith('FILERPROVIDES_'): 66 if key in ['PKG_%s' % pkg, 'DESCRIPTION', 'FILES_INFO'] or key.startswith('FILERPROVIDES_'):
66 if keyword_rc.search(value): 67 if keyword_rc.search(value):
67 match = True 68 match = True
68 break 69 break
69 70
70 if match: 71 if match:
71 print(fn) 72 rd = parse_recipe(config, tinfoil, fn, True)
73 summary = rd.getVar('SUMMARY', True)
74 if summary == rd.expand(defsummary):
75 summary = ''
76 print("%s %s" % (fn.ljust(20), summary))
77 finally:
78 tinfoil.shutdown()
72 79
73 return 0 80 return 0
74 81