package_manager.py: correctly handle empty opkg-query-helper.py output

If the output from opkg-query-helper.py is empty, output.split('\n')
would result in a list containing one element which is an empty string
while iterating over each line in the output. An exception is then
thrown by the line:

    pkg, pkg_file, pkg_arch = line.split()

with the message:

    Exception: ValueError: need more than 0 values to unpack

To avoid this, we add a condition to only split the output if it isn't
empty.

(From OE-Core rev: ee7b75c895e77ab20f728423c8efc2ced92265e8)

Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Jonathan Liu
2014-02-23 07:35:59 +00:00
committed by Richard Purdie
parent 1571cf6c68
commit 824cc75426

View File

@@ -1141,7 +1141,7 @@ class OpkgPM(PackageManager):
bb.fatal("Cannot get the installed packages list. Command '%s' "
"returned %d:\n%s" % (cmd, e.returncode, e.output))
if format == "file":
if output and format == "file":
tmp_output = ""
for line in output.split('\n'):
pkg, pkg_file, pkg_arch = line.split()