summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/package_manager.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe/package_manager.py')
-rw-r--r--meta/lib/oe/package_manager.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 0d23d8bc89..b4b359a8c6 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -468,13 +468,16 @@ class OpkgPkgsList(PkgsList):
468 def list_pkgs(self, format=None): 468 def list_pkgs(self, format=None):
469 cmd = "%s %s status" % (self.opkg_cmd, self.opkg_args) 469 cmd = "%s %s status" % (self.opkg_cmd, self.opkg_args)
470 470
471 try: 471 # opkg returns success even when it printed some
472 # bb.note(cmd) 472 # "Collected errors:" report to stderr. Mixing stderr into
473 cmd_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).strip() 473 # stdout then leads to random failures later on when
474 474 # parsing the output. To avoid this we need to collect both
475 except subprocess.CalledProcessError as e: 475 # output streams separately and check for empty stderr.
476 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
477 cmd_output, cmd_stderr = p.communicate()
478 if p.returncode or cmd_stderr:
476 bb.fatal("Cannot get the installed packages list. Command '%s' " 479 bb.fatal("Cannot get the installed packages list. Command '%s' "
477 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 480 "returned %d and stderr:\n%s" % (cmd, p.returncode, cmd_stderr))
478 481
479 return self.opkg_query(cmd_output) 482 return self.opkg_query(cmd_output)
480 483