oe-pkgdata-util: make find-path show a proper error if no package found

(From OE-Core rev: e13e53a30372a4cb3eabdb1b2199ff64c3e85cc3)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Eggleton 2015-02-06 11:12:07 +00:00 committed by Richard Purdie
parent 9f03969994
commit 1fb1caf15c
1 changed files with 5 additions and 0 deletions

View File

@ -239,6 +239,7 @@ def lookup_recipe(args):
def find_path(args):
import json
found = False
for root, dirs, files in os.walk(os.path.join(args.pkgdata_dir, 'runtime')):
for fn in files:
with open(os.path.join(root,fn)) as f:
@ -248,8 +249,12 @@ def find_path(args):
dictval = json.loads(val)
for fullpth in dictval.keys():
if fnmatch.fnmatchcase(fullpth, args.targetpath):
found = True
print("%s: %s" % (fn, fullpth))
break
if not found:
logger.error("Unable to find any package producing path %s" % args.targetpath)
sys.exit(1)
def main():