summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/package_manager.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-20 11:17:05 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-02 08:24:00 +0100
commita7309d5790f5dac46e84d3c14959943eb2496fda (patch)
tree48e1fcb886b8ef2974bade09694356f3230fb8a8 /meta/lib/oe/package_manager.py
parent297438e965053b2eb56cc8ef3e59465642f10a24 (diff)
downloadpoky-a7309d5790f5dac46e84d3c14959943eb2496fda.tar.gz
classes/lib: Update to use python3 command pipeline decoding
In python3, strings are unicode by default. We need to encode/decode from command pipelines and other places where we interface with the real world using the correct locales. This patch updates various call sites to use the correct encoding/decodings. (From OE-Core rev: bb4685af1bffe17b3aa92a6d21398f38a44ea874) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/package_manager.py')
-rw-r--r--meta/lib/oe/package_manager.py88
1 files changed, 45 insertions, 43 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 3bc4ebf5b4..abe9f6878b 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -17,10 +17,10 @@ def create_index(arg):
17 17
18 try: 18 try:
19 bb.note("Executing '%s' ..." % index_cmd) 19 bb.note("Executing '%s' ..." % index_cmd)
20 result = subprocess.check_output(index_cmd, stderr=subprocess.STDOUT, shell=True) 20 result = subprocess.check_output(index_cmd, stderr=subprocess.STDOUT, shell=True).decode("utf-8")
21 except subprocess.CalledProcessError as e: 21 except subprocess.CalledProcessError as e:
22 return("Index creation command '%s' failed with return code %d:\n%s" % 22 return("Index creation command '%s' failed with return code %d:\n%s" %
23 (e.cmd, e.returncode, e.output)) 23 (e.cmd, e.returncode, e.output.decode("utf-8")))
24 24
25 if result: 25 if result:
26 bb.note(result) 26 bb.note(result)
@@ -367,10 +367,10 @@ class RpmPkgsList(PkgsList):
367 # Determine rpm version 367 # Determine rpm version
368 cmd = "%s --version" % self.rpm_cmd 368 cmd = "%s --version" % self.rpm_cmd
369 try: 369 try:
370 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) 370 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).decode("utf-8")
371 except subprocess.CalledProcessError as e: 371 except subprocess.CalledProcessError as e:
372 bb.fatal("Getting rpm version failed. Command '%s' " 372 bb.fatal("Getting rpm version failed. Command '%s' "
373 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 373 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
374 374
375 ''' 375 '''
376 Translate the RPM/Smart format names to the OE multilib format names 376 Translate the RPM/Smart format names to the OE multilib format names
@@ -411,10 +411,10 @@ class RpmPkgsList(PkgsList):
411 "-t", self.image_rpmlib] 411 "-t", self.image_rpmlib]
412 412
413 try: 413 try:
414 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).strip() 414 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).strip().decode("utf-8")
415 except subprocess.CalledProcessError as e: 415 except subprocess.CalledProcessError as e:
416 bb.fatal("Cannot get the package dependencies. Command '%s' " 416 bb.fatal("Cannot get the package dependencies. Command '%s' "
417 "returned %d:\n%s" % (' '.join(cmd), e.returncode, e.output)) 417 "returned %d:\n%s" % (' '.join(cmd), e.returncode, e.output.decode("utf-8")))
418 418
419 return output 419 return output
420 420
@@ -425,10 +425,10 @@ class RpmPkgsList(PkgsList):
425 425
426 try: 426 try:
427 # bb.note(cmd) 427 # bb.note(cmd)
428 tmp_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).strip() 428 tmp_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).strip().decode("utf-8")
429 except subprocess.CalledProcessError as e: 429 except subprocess.CalledProcessError as e:
430 bb.fatal("Cannot get the installed packages list. Command '%s' " 430 bb.fatal("Cannot get the installed packages list. Command '%s' "
431 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 431 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
432 432
433 output = dict() 433 output = dict()
434 deps = dict() 434 deps = dict()
@@ -485,6 +485,8 @@ class OpkgPkgsList(PkgsList):
485 # output streams separately and check for empty stderr. 485 # output streams separately and check for empty stderr.
486 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) 486 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
487 cmd_output, cmd_stderr = p.communicate() 487 cmd_output, cmd_stderr = p.communicate()
488 cmd_output = cmd_output.decode("utf-8")
489 cmd_stderr = cmd_stderr.decode("utf-8")
488 if p.returncode or cmd_stderr: 490 if p.returncode or cmd_stderr:
489 bb.fatal("Cannot get the installed packages list. Command '%s' " 491 bb.fatal("Cannot get the installed packages list. Command '%s' "
490 "returned %d and stderr:\n%s" % (cmd, p.returncode, cmd_stderr)) 492 "returned %d and stderr:\n%s" % (cmd, p.returncode, cmd_stderr))
@@ -502,10 +504,10 @@ class DpkgPkgsList(PkgsList):
502 cmd.append("-f=Package: ${Package}\nArchitecture: ${PackageArch}\nVersion: ${Version}\nFile: ${Package}_${Version}_${Architecture}.deb\nDepends: ${Depends}\nRecommends: ${Recommends}\n\n") 504 cmd.append("-f=Package: ${Package}\nArchitecture: ${PackageArch}\nVersion: ${Version}\nFile: ${Package}_${Version}_${Architecture}.deb\nDepends: ${Depends}\nRecommends: ${Recommends}\n\n")
503 505
504 try: 506 try:
505 cmd_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).strip() 507 cmd_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).strip().decode("utf-8")
506 except subprocess.CalledProcessError as e: 508 except subprocess.CalledProcessError as e:
507 bb.fatal("Cannot get the installed packages list. Command '%s' " 509 bb.fatal("Cannot get the installed packages list. Command '%s' "
508 "returned %d:\n%s" % (' '.join(cmd), e.returncode, e.output)) 510 "returned %d:\n%s" % (' '.join(cmd), e.returncode, e.output.decode("utf-8")))
509 511
510 return opkg_query(cmd_output) 512 return opkg_query(cmd_output)
511 513
@@ -608,11 +610,11 @@ class PackageManager(object):
608 try: 610 try:
609 bb.note("Installing complementary packages ...") 611 bb.note("Installing complementary packages ...")
610 bb.note('Running %s' % cmd) 612 bb.note('Running %s' % cmd)
611 complementary_pkgs = subprocess.check_output(cmd, stderr=subprocess.STDOUT) 613 complementary_pkgs = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode("utf-8")
612 except subprocess.CalledProcessError as e: 614 except subprocess.CalledProcessError as e:
613 bb.fatal("Could not compute complementary packages list. Command " 615 bb.fatal("Could not compute complementary packages list. Command "
614 "'%s' returned %d:\n%s" % 616 "'%s' returned %d:\n%s" %
615 (' '.join(cmd), e.returncode, e.output)) 617 (' '.join(cmd), e.returncode, e.output.decode("utf-8")))
616 self.install(complementary_pkgs.split(), attempt_only=True) 618 self.install(complementary_pkgs.split(), attempt_only=True)
617 os.remove(installed_pkgs_file) 619 os.remove(installed_pkgs_file)
618 620
@@ -784,12 +786,12 @@ class RpmPM(PackageManager):
784 try: 786 try:
785 complementary_pkgs = subprocess.check_output(cmd, 787 complementary_pkgs = subprocess.check_output(cmd,
786 stderr=subprocess.STDOUT, 788 stderr=subprocess.STDOUT,
787 shell=True) 789 shell=True).decode("utf-8")
788 # bb.note(complementary_pkgs) 790 # bb.note(complementary_pkgs)
789 return complementary_pkgs 791 return complementary_pkgs
790 except subprocess.CalledProcessError as e: 792 except subprocess.CalledProcessError as e:
791 bb.fatal("Could not invoke smart. Command " 793 bb.fatal("Could not invoke smart. Command "
792 "'%s' returned %d:\n%s" % (cmd, e.returncode, e.output)) 794 "'%s' returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
793 795
794 def _search_pkg_name_in_feeds(self, pkg, feed_archs): 796 def _search_pkg_name_in_feeds(self, pkg, feed_archs):
795 for arch in feed_archs: 797 for arch in feed_archs:
@@ -808,7 +810,7 @@ class RpmPM(PackageManager):
808 (self.smart_cmd, self.smart_opt, pkg) 810 (self.smart_cmd, self.smart_opt, pkg)
809 cmd += " | sed -ne 's/ *Provides://p'" 811 cmd += " | sed -ne 's/ *Provides://p'"
810 bb.note('cmd: %s' % cmd) 812 bb.note('cmd: %s' % cmd)
811 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) 813 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).decode("utf-8")
812 # Found a provider 814 # Found a provider
813 if output: 815 if output:
814 bb.note('Found providers for %s: %s' % (pkg, output)) 816 bb.note('Found providers for %s: %s' % (pkg, output))
@@ -956,7 +958,7 @@ class RpmPM(PackageManager):
956 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) 958 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
957 except subprocess.CalledProcessError as e: 959 except subprocess.CalledProcessError as e:
958 bb.fatal("Create rpm database failed. Command '%s' " 960 bb.fatal("Create rpm database failed. Command '%s' "
959 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 961 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
960 # Import GPG key to RPM database of the target system 962 # Import GPG key to RPM database of the target system
961 if self.d.getVar('RPM_SIGN_PACKAGES', True) == '1': 963 if self.d.getVar('RPM_SIGN_PACKAGES', True) == '1':
962 pubkey_path = self.d.getVar('RPM_GPG_PUBKEY', True) 964 pubkey_path = self.d.getVar('RPM_GPG_PUBKEY', True)
@@ -1203,11 +1205,11 @@ class RpmPM(PackageManager):
1203 cmd = "%s %s install --attempt -y %s" % \ 1205 cmd = "%s %s install --attempt -y %s" % \
1204 (self.smart_cmd, self.smart_opt, ' '.join(pkgs)) 1206 (self.smart_cmd, self.smart_opt, ' '.join(pkgs))
1205 try: 1207 try:
1206 output = subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT) 1208 output = subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT).decode("utf-8")
1207 bb.note(output) 1209 bb.note(output)
1208 except subprocess.CalledProcessError as e: 1210 except subprocess.CalledProcessError as e:
1209 bb.fatal("Unable to install packages. Command '%s' " 1211 bb.fatal("Unable to install packages. Command '%s' "
1210 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 1212 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
1211 1213
1212 ''' 1214 '''
1213 Remove pkgs with smart, the pkg name is smart/rpm format 1215 Remove pkgs with smart, the pkg name is smart/rpm format
@@ -1233,11 +1235,11 @@ class RpmPM(PackageManager):
1233 1235
1234 try: 1236 try:
1235 bb.note(cmd) 1237 bb.note(cmd)
1236 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) 1238 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).decode("utf-8")
1237 bb.note(output) 1239 bb.note(output)
1238 except subprocess.CalledProcessError as e: 1240 except subprocess.CalledProcessError as e:
1239 bb.note("Unable to remove packages. Command '%s' " 1241 bb.note("Unable to remove packages. Command '%s' "
1240 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 1242 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
1241 1243
1242 def upgrade(self): 1244 def upgrade(self):
1243 bb.note('smart upgrade') 1245 bb.note('smart upgrade')
@@ -1310,7 +1312,7 @@ class RpmPM(PackageManager):
1310 install_pkgs.append(pkg) 1312 install_pkgs.append(pkg)
1311 except subprocess.CalledProcessError as e: 1313 except subprocess.CalledProcessError as e:
1312 bb.note("Unable to dump install packages. Command '%s' " 1314 bb.note("Unable to dump install packages. Command '%s' "
1313 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 1315 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
1314 # Recovery rpmsys channel 1316 # Recovery rpmsys channel
1315 self._invoke_smart('channel --enable rpmsys') 1317 self._invoke_smart('channel --enable rpmsys')
1316 return install_pkgs 1318 return install_pkgs
@@ -1352,7 +1354,7 @@ class RpmPM(PackageManager):
1352 available_pkgs.append(pkg.strip()) 1354 available_pkgs.append(pkg.strip())
1353 except subprocess.CalledProcessError as e: 1355 except subprocess.CalledProcessError as e:
1354 bb.note("Unable to list all available packages. Command '%s' " 1356 bb.note("Unable to list all available packages. Command '%s' "
1355 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 1357 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
1356 1358
1357 self.fullpkglist = available_pkgs 1359 self.fullpkglist = available_pkgs
1358 1360
@@ -1379,12 +1381,12 @@ class RpmPM(PackageManager):
1379 1381
1380 try: 1382 try:
1381 bb.note(cmd) 1383 bb.note(cmd)
1382 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).strip() 1384 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).strip().decode("utf-8")
1383 bb.note(output) 1385 bb.note(output)
1384 os.chmod(saved_dir, 0755) 1386 os.chmod(saved_dir, 0o755)
1385 except subprocess.CalledProcessError as e: 1387 except subprocess.CalledProcessError as e:
1386 bb.fatal("Invoke save_rpmpostinst failed. Command '%s' " 1388 bb.fatal("Invoke save_rpmpostinst failed. Command '%s' "
1387 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 1389 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
1388 1390
1389 '''Write common configuration for target usage''' 1391 '''Write common configuration for target usage'''
1390 def rpm_setup_smart_target_config(self): 1392 def rpm_setup_smart_target_config(self):
@@ -1417,7 +1419,7 @@ class RpmPM(PackageManager):
1417 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) 1419 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
1418 except subprocess.CalledProcessError as e: 1420 except subprocess.CalledProcessError as e:
1419 bb.fatal("Unable to list available packages. Command '%s' " 1421 bb.fatal("Unable to list available packages. Command '%s' "
1420 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 1422 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
1421 1423
1422 # Set default values to avoid UnboundLocalError 1424 # Set default values to avoid UnboundLocalError
1423 arch = "" 1425 arch = ""
@@ -1482,7 +1484,7 @@ class RpmPM(PackageManager):
1482 except subprocess.CalledProcessError as e: 1484 except subprocess.CalledProcessError as e:
1483 bb.utils.remove(tmp_dir, recurse=True) 1485 bb.utils.remove(tmp_dir, recurse=True)
1484 bb.fatal("Unable to extract %s package. Command '%s' " 1486 bb.fatal("Unable to extract %s package. Command '%s' "
1485 "returned %d:\n%s" % (pkg_path, cmd, e.returncode, e.output)) 1487 "returned %d:\n%s" % (pkg_path, cmd, e.returncode, e.output.decode("utf-8")))
1486 except OSError as e: 1488 except OSError as e:
1487 bb.utils.remove(tmp_dir, recurse=True) 1489 bb.utils.remove(tmp_dir, recurse=True)
1488 bb.fatal("Unable to extract %s package. Command '%s' " 1490 bb.fatal("Unable to extract %s package. Command '%s' "
@@ -1512,7 +1514,7 @@ class OpkgDpkgPM(PackageManager):
1512 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) 1514 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
1513 except subprocess.CalledProcessError as e: 1515 except subprocess.CalledProcessError as e:
1514 bb.fatal("Unable to list available packages. Command '%s' " 1516 bb.fatal("Unable to list available packages. Command '%s' "
1515 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 1517 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
1516 return opkg_query(output) 1518 return opkg_query(output)
1517 1519
1518 """ 1520 """
@@ -1544,7 +1546,7 @@ class OpkgDpkgPM(PackageManager):
1544 except subprocess.CalledProcessError as e: 1546 except subprocess.CalledProcessError as e:
1545 bb.utils.remove(tmp_dir, recurse=True) 1547 bb.utils.remove(tmp_dir, recurse=True)
1546 bb.fatal("Unable to extract %s package. Command '%s' " 1548 bb.fatal("Unable to extract %s package. Command '%s' "
1547 "returned %d:\n%s" % (pkg_path, cmd, e.returncode, e.output)) 1549 "returned %d:\n%s" % (pkg_path, cmd, e.returncode, e.output.decode("utf-8")))
1548 except OSError as e: 1550 except OSError as e:
1549 bb.utils.remove(tmp_dir, recurse=True) 1551 bb.utils.remove(tmp_dir, recurse=True)
1550 bb.fatal("Unable to extract %s package. Command '%s' " 1552 bb.fatal("Unable to extract %s package. Command '%s' "
@@ -1733,7 +1735,7 @@ class OpkgPM(OpkgDpkgPM):
1733 except subprocess.CalledProcessError as e: 1735 except subprocess.CalledProcessError as e:
1734 self.deploy_dir_unlock() 1736 self.deploy_dir_unlock()
1735 bb.fatal("Unable to update the package index files. Command '%s' " 1737 bb.fatal("Unable to update the package index files. Command '%s' "
1736 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 1738 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
1737 1739
1738 self.deploy_dir_unlock() 1740 self.deploy_dir_unlock()
1739 1741
@@ -1754,12 +1756,12 @@ class OpkgPM(OpkgDpkgPM):
1754 try: 1756 try:
1755 bb.note("Installing the following packages: %s" % ' '.join(pkgs)) 1757 bb.note("Installing the following packages: %s" % ' '.join(pkgs))
1756 bb.note(cmd) 1758 bb.note(cmd)
1757 output = subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT) 1759 output = subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT).decode("utf-8")
1758 bb.note(output) 1760 bb.note(output)
1759 except subprocess.CalledProcessError as e: 1761 except subprocess.CalledProcessError as e:
1760 (bb.fatal, bb.note)[attempt_only]("Unable to install packages. " 1762 (bb.fatal, bb.note)[attempt_only]("Unable to install packages. "
1761 "Command '%s' returned %d:\n%s" % 1763 "Command '%s' returned %d:\n%s" %
1762 (cmd, e.returncode, e.output)) 1764 (cmd, e.returncode, e.output.decode("utf-8")))
1763 1765
1764 def remove(self, pkgs, with_dependencies=True): 1766 def remove(self, pkgs, with_dependencies=True):
1765 if with_dependencies: 1767 if with_dependencies:
@@ -1771,11 +1773,11 @@ class OpkgPM(OpkgDpkgPM):
1771 1773
1772 try: 1774 try:
1773 bb.note(cmd) 1775 bb.note(cmd)
1774 output = subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT) 1776 output = subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT).decode("utf-8")
1775 bb.note(output) 1777 bb.note(output)
1776 except subprocess.CalledProcessError as e: 1778 except subprocess.CalledProcessError as e:
1777 bb.fatal("Unable to remove packages. Command '%s' " 1779 bb.fatal("Unable to remove packages. Command '%s' "
1778 "returned %d:\n%s" % (e.cmd, e.returncode, e.output)) 1780 "returned %d:\n%s" % (e.cmd, e.returncode, e.output.decode("utf-8")))
1779 1781
1780 def write_index(self): 1782 def write_index(self):
1781 self.deploy_dir_lock() 1783 self.deploy_dir_lock()
@@ -1818,10 +1820,10 @@ class OpkgPM(OpkgDpkgPM):
1818 pkg_info = cmd + pkg 1820 pkg_info = cmd + pkg
1819 1821
1820 try: 1822 try:
1821 output = subprocess.check_output(pkg_info.split(), stderr=subprocess.STDOUT).strip() 1823 output = subprocess.check_output(pkg_info.split(), stderr=subprocess.STDOUT).strip().decode("utf-8")
1822 except subprocess.CalledProcessError as e: 1824 except subprocess.CalledProcessError as e:
1823 bb.fatal("Cannot get package info. Command '%s' " 1825 bb.fatal("Cannot get package info. Command '%s' "
1824 "returned %d:\n%s" % (pkg_info, e.returncode, e.output)) 1826 "returned %d:\n%s" % (pkg_info, e.returncode, e.output.decode("utf-8")))
1825 1827
1826 if output == "": 1828 if output == "":
1827 bb.note("Ignored bad recommendation: '%s' is " 1829 bb.note("Ignored bad recommendation: '%s' is "
@@ -1858,7 +1860,7 @@ class OpkgPM(OpkgDpkgPM):
1858 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) 1860 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
1859 except subprocess.CalledProcessError as e: 1861 except subprocess.CalledProcessError as e:
1860 bb.fatal("Unable to update. Command '%s' " 1862 bb.fatal("Unable to update. Command '%s' "
1861 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 1863 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
1862 1864
1863 # Dummy installation 1865 # Dummy installation
1864 cmd = "%s %s --noaction install %s " % (self.opkg_cmd, 1866 cmd = "%s %s --noaction install %s " % (self.opkg_cmd,
@@ -1868,7 +1870,7 @@ class OpkgPM(OpkgDpkgPM):
1868 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) 1870 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
1869 except subprocess.CalledProcessError as e: 1871 except subprocess.CalledProcessError as e:
1870 bb.fatal("Unable to dummy install packages. Command '%s' " 1872 bb.fatal("Unable to dummy install packages. Command '%s' "
1871 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 1873 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
1872 1874
1873 bb.utils.remove(temp_rootfs, True) 1875 bb.utils.remove(temp_rootfs, True)
1874 1876
@@ -2012,7 +2014,7 @@ class DpkgPM(OpkgDpkgPM):
2012 subprocess.check_output(p_full, stderr=subprocess.STDOUT) 2014 subprocess.check_output(p_full, stderr=subprocess.STDOUT)
2013 except subprocess.CalledProcessError as e: 2015 except subprocess.CalledProcessError as e:
2014 bb.note("%s for package %s failed with %d:\n%s" % 2016 bb.note("%s for package %s failed with %d:\n%s" %
2015 (suffix[1], pkg_name, e.returncode, e.output)) 2017 (suffix[1], pkg_name, e.returncode, e.output.decode("utf-8")))
2016 failed_pkgs.append(pkg_name) 2018 failed_pkgs.append(pkg_name)
2017 break 2019 break
2018 2020
@@ -2030,7 +2032,7 @@ class DpkgPM(OpkgDpkgPM):
2030 subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT) 2032 subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT)
2031 except subprocess.CalledProcessError as e: 2033 except subprocess.CalledProcessError as e:
2032 bb.fatal("Unable to update the package index files. Command '%s' " 2034 bb.fatal("Unable to update the package index files. Command '%s' "
2033 "returned %d:\n%s" % (e.cmd, e.returncode, e.output)) 2035 "returned %d:\n%s" % (e.cmd, e.returncode, e.output.decode("utf-8")))
2034 2036
2035 self.deploy_dir_unlock() 2037 self.deploy_dir_unlock()
2036 2038
@@ -2049,7 +2051,7 @@ class DpkgPM(OpkgDpkgPM):
2049 except subprocess.CalledProcessError as e: 2051 except subprocess.CalledProcessError as e:
2050 (bb.fatal, bb.note)[attempt_only]("Unable to install packages. " 2052 (bb.fatal, bb.note)[attempt_only]("Unable to install packages. "
2051 "Command '%s' returned %d:\n%s" % 2053 "Command '%s' returned %d:\n%s" %
2052 (cmd, e.returncode, e.output)) 2054 (cmd, e.returncode, e.output.decode("utf-8")))
2053 2055
2054 # rename *.dpkg-new files/dirs 2056 # rename *.dpkg-new files/dirs
2055 for root, dirs, files in os.walk(self.target_rootfs): 2057 for root, dirs, files in os.walk(self.target_rootfs):
@@ -2080,7 +2082,7 @@ class DpkgPM(OpkgDpkgPM):
2080 subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT) 2082 subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT)
2081 except subprocess.CalledProcessError as e: 2083 except subprocess.CalledProcessError as e:
2082 bb.fatal("Unable to remove packages. Command '%s' " 2084 bb.fatal("Unable to remove packages. Command '%s' "
2083 "returned %d:\n%s" % (e.cmd, e.returncode, e.output)) 2085 "returned %d:\n%s" % (e.cmd, e.returncode, e.output.decode("utf-8")))
2084 2086
2085 def write_index(self): 2087 def write_index(self):
2086 self.deploy_dir_lock() 2088 self.deploy_dir_lock()
@@ -2213,7 +2215,7 @@ class DpkgPM(OpkgDpkgPM):
2213 subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT) 2215 subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT)
2214 except subprocess.CalledProcessError as e: 2216 except subprocess.CalledProcessError as e:
2215 bb.fatal("Cannot fix broken dependencies. Command '%s' " 2217 bb.fatal("Cannot fix broken dependencies. Command '%s' "
2216 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 2218 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
2217 2219
2218 def list_installed(self): 2220 def list_installed(self):
2219 return DpkgPkgsList(self.d, self.target_rootfs).list_pkgs() 2221 return DpkgPkgsList(self.d, self.target_rootfs).list_pkgs()