oe-pkgdata-util: improve resiliance of lookup-recipe

Message ID 20180814162113.22774-1-ross.burton@intel.com
State New
Headers show
Series
  • oe-pkgdata-util: improve resiliance of lookup-recipe
Related show

Commit Message

Ross Burton Aug. 14, 2018, 4:21 p.m.
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 <ross.burton@intel.com>

---
 scripts/oe-pkgdata-util | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

-- 
2.11.0

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Comments

Richard Purdie Aug. 15, 2018, 8:31 a.m. | #1
On Tue, 2018-08-14 at 17:21 +0100, Ross Burton wrote:
> 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 <ross.burton@intel.com>

> ---

>  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

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Patch

diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
index e6c9df94e83..5d2e328ee08 100755
--- a/scripts/oe-pkgdata-util
+++ b/scripts/oe-pkgdata-util
@@ -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):