The cmd redirected stderr to stdout that was then assigned to variable
with pkgs to install. Then this variable was passed to package manager
that then tried to install it and generated confusing warnings.

For example this variable could contain:
| ['(en_US.UTF-8)', 'LC_ALL:', 'bash:', 'cannot', 'change', 'locale', 
'setlocale:', 'warning:']

and the warning was:

| WARNING: addon-bci-1.0-r0 do_populate_sdk: Unable to install packages.
| Command 'PATH/usr/bin/opkg ... install (en_US.UTF-8) LC_ALL: bash:
| cannot change locale setlocale: warning:' returned 255:
| Collected errors:
|  * opkg_prepare_url_for_install: Couldn't find anything to satisfy 
'(en_US.UTF-8)'.

In this change I remove stderr redirection to stdout and pass it to
bb.note instead.

Signed-off-by: Tomasz Dziendzielski <[email protected]>
---
 meta/lib/oe/package_manager/__init__.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oe/package_manager/__init__.py 
b/meta/lib/oe/package_manager/__init__.py
index 42225a3b2e..8e7128b195 100644
--- a/meta/lib/oe/package_manager/__init__.py
+++ b/meta/lib/oe/package_manager/__init__.py
@@ -328,7 +328,11 @@ class PackageManager(object, metaclass=ABCMeta):
         try:
             bb.note("Installing globbed packages...")
             cmd = ["oe-pkgdata-util", "-p", pkgdatadir, "list-pkgs", globs]
-            pkgs = subprocess.check_output(cmd, 
stderr=subprocess.STDOUT).decode("utf-8")
+            bb.note('Running %s' % cmd)
+            proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE)
+            stdout, stderr = proc.communicate()
+            if stderr: bb.note(stderr.decode("utf-8"))
+            pkgs = stdout.decode("utf-8")
             self.install(pkgs.split(), attempt_only=True)
         except subprocess.CalledProcessError as e:
             # Return code 1 means no packages matched
@@ -384,7 +388,10 @@ class PackageManager(object, metaclass=ABCMeta):
                 cmd.extend(['--exclude=' + '|'.join(exclude.split())])
             try:
                 bb.note('Running %s' % cmd)
-                complementary_pkgs = subprocess.check_output(cmd, 
stderr=subprocess.STDOUT).decode("utf-8")
+                proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE)
+                stdout, stderr = proc.communicate()
+                if stderr: bb.note(stderr.decode("utf-8"))
+                complementary_pkgs = stdout.decode("utf-8")
                 complementary_pkgs = set(complementary_pkgs.split())
                 skip_pkgs = sorted(complementary_pkgs & provided_pkgs)
                 install_pkgs = sorted(complementary_pkgs - provided_pkgs)
-- 
2.30.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#147312): 
https://lists.openembedded.org/g/openembedded-core/message/147312
Mute This Topic: https://lists.openembedded.org/mt/80134476/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to