Skip to contentSkip to conversation

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

PATCH New Jonathan Liu 1 participant 1 message Feb 23, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 meta/lib/oe/package_manager.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oe/package_manager.py +1 -1
index b430ee3..d29adac 100644
@@ -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()
Signature · 1 line
1.9.0