summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorShruthi Ravichandran <shruthi.ravichandran@ni.com>2022-07-21 00:19:49 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-08 16:23:37 +0100
commitf6bc8dfadb6ccb961f26c43bc30dfce581bbacd7 (patch)
tree7e2021c8ac9c340af15e7df99478849ffb3b8ffc /meta
parent03e778a6361db971f348c6da646fa13778fdafe4 (diff)
downloadpoky-f6bc8dfadb6ccb961f26c43bc30dfce581bbacd7.tar.gz
package_manager/ipk: do not pipe stderr to stdout
Some opkg commands print an error during cleanup when the tmp_dir does not exist and an attempt is made to delete it. The error messages are harmless and the opkg commands eventually succeed. When these commands are run and stderr is piped to stdout, the error messages may clobber the stdout and cause unexpected results while parsing the output of the command. Therefore, when parsing the output of a command, do not pipe stderr to stdout. Instead, capture stderr and stdout separately, and upon success, send stderr to bb.note(). (From OE-Core rev: fd5689696731fefa0d035fde86f27a0135dc31f1) Signed-off-by: Shruthi Ravichandran <shruthi.ravichandran@ni.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit f2167ae80258253eb47a5b148546b265320284cc) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oe/package_manager/ipk/__init__.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/meta/lib/oe/package_manager/ipk/__init__.py b/meta/lib/oe/package_manager/ipk/__init__.py
index 4cd3963111..9f60f3abcc 100644
--- a/meta/lib/oe/package_manager/ipk/__init__.py
+++ b/meta/lib/oe/package_manager/ipk/__init__.py
@@ -102,12 +102,14 @@ class OpkgDpkgPM(PackageManager):
102 This method extracts the common parts for Opkg and Dpkg 102 This method extracts the common parts for Opkg and Dpkg
103 """ 103 """
104 104
105 try: 105 proc = subprocess.run(cmd, capture_output=True, encoding="utf-8", shell=True)
106 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).decode("utf-8") 106 if proc.returncode:
107 except subprocess.CalledProcessError as e:
108 bb.fatal("Unable to list available packages. Command '%s' " 107 bb.fatal("Unable to list available packages. Command '%s' "
109 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8"))) 108 "returned %d:\n%s" % (cmd, proc.returncode, proc.stderr))
110 return opkg_query(output) 109 elif proc.stderr:
110 bb.note("Command '%s' returned stderr: %s" % (cmd, proc.stderr))
111
112 return opkg_query(proc.stdout)
111 113
112 def extract(self, pkg, pkg_info): 114 def extract(self, pkg, pkg_info):
113 """ 115 """
@@ -443,15 +445,16 @@ class OpkgPM(OpkgDpkgPM):
443 cmd = "%s %s --noaction install %s " % (self.opkg_cmd, 445 cmd = "%s %s --noaction install %s " % (self.opkg_cmd,
444 opkg_args, 446 opkg_args,
445 ' '.join(pkgs)) 447 ' '.join(pkgs))
446 try: 448 proc = subprocess.run(cmd, capture_output=True, encoding="utf-8", shell=True)
447 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) 449 if proc.returncode:
448 except subprocess.CalledProcessError as e:
449 bb.fatal("Unable to dummy install packages. Command '%s' " 450 bb.fatal("Unable to dummy install packages. Command '%s' "
450 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8"))) 451 "returned %d:\n%s" % (cmd, proc.returncode, proc.stderr))
452 elif proc.stderr:
453 bb.note("Command '%s' returned stderr: %s" % (cmd, proc.stderr))
451 454
452 bb.utils.remove(temp_rootfs, True) 455 bb.utils.remove(temp_rootfs, True)
453 456
454 return output 457 return proc.stdout
455 458
456 def backup_packaging_data(self): 459 def backup_packaging_data(self):
457 # Save the opkglib for increment ipk image generation 460 # Save the opkglib for increment ipk image generation