oe-pkgdata-util: improve resiliance of lookup-recipe
PATCH 1/1 oe-pkgdata-util: improve resiliance of lookup-recipe
If we can't find the pkgdata for a package, instead of erroring out just emit a message and continue.
This makes it possible to pass long lists of packages to oe-pkgdata-util and process the output.
Signed-off-by Ross Burton <[email protected]>
--- scripts/oe-pkgdata-util | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
scripts/oe-pkgdata-util +4 -4
@@ -279,10 +279,10 @@ def lookup_recipe(args): parse_pkgdatafile(pkgdatafile) continue pkgdatafile = os.path.join(args.pkgdata_dir, 'runtime-reverse', pkg) - if not os.path.exists(pkgdatafile): - logger.error("The following packages could not be found: %s" % pkg) - sys.exit(1) - parse_pkgdatafile(pkgdatafile) + if os.path.exists(pkgdatafile): + parse_pkgdatafile(pkgdatafile) + else: + print("The following packages could not be found: %s" % pkg) def package_info(args): def parse_pkgdatafile(pkgdatafile):
Signature · 1 line
2.11.0
Quoted 4 lines · Ross Burton
If we can't find the pkgdata for a package, instead of erroring out just emit a
message and continue.
Quoted 8 lines
This makes it possible to pass long lists of packages to oe-pkgdata- util and
process the output.Signed-off-by Ross Burton <[email protected]>--- scripts/oe-pkgdata-util | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Fails in oe-selftest:
2018-08-15 01:35:23,638 - oe-selftest - INFO - ======================================================================
2018-08-15 01:35:23,638 - oe-selftest - INFO - FAIL: pkgdata.OePkgdataUtilTests.test_lookup_recipe (subunit.RemotedTestCase)
2018-08-15 01:35:23,638 - oe-selftest - INFO - ----------------------------------------------------------------------
2018-08-15 01:35:23,638 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/core/decorator/__init__.py", line 32, in wrapped_f
return func(*args, **kwargs)
File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/selftest/cases/pkgdata.py", line 64, in test_lookup_recipe
self.assertEqual(result.status, 1, "Status different than 1. output: %s" % result.output)
File "/usr/lib/python3.5/unittest/case.py", line 821, in assertEqual
assertion_func(first, second, msg=msg)
File "/usr/lib/python3.5/unittest/case.py", line 814, in _baseAssertEqual
raise self.failureException(msg)AssertionError: 0 != 1 : Status different than 1. output: The following packages could not be found: nonexistentpkg