summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe
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-07-25 22:59:00 +0100
commit17e2eaed036e1da8e7cb42cb3de51b9523ba54ec (patch)
treeafa20d092a7b081ac02d00b7c998c2d348123c01 /meta/lib/oe
parentd69229e7247fc68b881181fb6a3995bff990d4c8 (diff)
downloadpoky-17e2eaed036e1da8e7cb42cb3de51b9523ba54ec.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: f2167ae80258253eb47a5b148546b265320284cc) Signed-off-by: Shruthi Ravichandran <shruthi.ravichandran@ni.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-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 6fd2f021b6..7cbea0fa80 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 """
@@ -445,15 +447,16 @@ class OpkgPM(OpkgDpkgPM):
445 cmd = "%s %s --noaction install %s " % (self.opkg_cmd, 447 cmd = "%s %s --noaction install %s " % (self.opkg_cmd,
446 opkg_args, 448 opkg_args,
447 ' '.join(pkgs)) 449 ' '.join(pkgs))
448 try: 450 proc = subprocess.run(cmd, capture_output=True, encoding="utf-8", shell=True)
449 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) 451 if proc.returncode:
450 except subprocess.CalledProcessError as e:
451 bb.fatal("Unable to dummy install packages. Command '%s' " 452 bb.fatal("Unable to dummy install packages. Command '%s' "
452 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8"))) 453 "returned %d:\n%s" % (cmd, proc.returncode, proc.stderr))
454 elif proc.stderr:
455 bb.note("Command '%s' returned stderr: %s" % (cmd, proc.stderr))
453 456
454 bb.utils.remove(temp_rootfs, True) 457 bb.utils.remove(temp_rootfs, True)
455 458
456 return output 459 return proc.stdout
457 460
458 def backup_packaging_data(self): 461 def backup_packaging_data(self):
459 # Save the opkglib for increment ipk image generation 462 # Save the opkglib for increment ipk image generation