]> code.ossystems Code Review - openembedded-core.git/commitdiff
package_manager.py: correctly handle empty opkg-query-helper.py output
authorJonathan Liu <net147@gmail.com>
Sun, 23 Feb 2014 07:35:59 +0000 (07:35 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 25 Feb 2014 08:03:09 +0000 (08:03 +0000)
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.

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>
meta/lib/oe/package_manager.py

index b430ee3a625defb8daa8ad87cbec4e6b082cbcf1..d29adaca7b94c79f925e557283397c0d8da37044 100644 (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()