[oe-commits] Jonathan Liu : package_manager.py: correctly handle empty opkg-query-helper.py output

git at git.openembedded.org git at git.openembedded.org
Tue Feb 25 07:57:17 UTC 2014


Module: openembedded-core.git
Branch: master
Commit: ee7b75c895e77ab20f728423c8efc2ced92265e8
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=ee7b75c895e77ab20f728423c8efc2ced92265e8

Author: Jonathan Liu <net147 at gmail.com>
Date:   Sun Feb 23 07:35:59 2014 +0000

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.

Signed-off-by: Jonathan Liu <net147 at gmail.com>
Signed-off-by: Saul Wold <sgw at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/lib/oe/package_manager.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index b430ee3..d29adac 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -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()



More information about the Openembedded-commits mailing list