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.py81
1 files changed, 41 insertions, 40 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 49b5ac8e75..9884c3a712 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -16,8 +16,8 @@ def create_index(arg):
16 bb.note("Executing '%s' ..." % index_cmd) 16 bb.note("Executing '%s' ..." % index_cmd)
17 subprocess.check_output(index_cmd, shell=True) 17 subprocess.check_output(index_cmd, shell=True)
18 except subprocess.CalledProcessError as e: 18 except subprocess.CalledProcessError as e:
19 return("Index creation command %s failed with return code %d!" % 19 return("Index creation command '%s' failed with return code %d:\n%s" %
20 (e.cmd, e.returncode)) 20 (e.cmd, e.returncode, e.output))
21 21
22 return None 22 return None
23 23
@@ -110,7 +110,8 @@ class PackageManager(object):
110 complementary_pkgs = subprocess.check_output(cmd) 110 complementary_pkgs = subprocess.check_output(cmd)
111 except subprocess.CalledProcessError as e: 111 except subprocess.CalledProcessError as e:
112 bb.fatal("Could not compute complementary packages list. Command " 112 bb.fatal("Could not compute complementary packages list. Command "
113 "%s returned %d!" % (' '.join(cmd), e.returncode)) 113 "'%s' returned %d:\n%s" %
114 (' '.join(cmd), e.returncode, e.output))
114 115
115 self.install(complementary_pkgs.split(), attempt_only=True) 116 self.install(complementary_pkgs.split(), attempt_only=True)
116 117
@@ -211,7 +212,7 @@ class RpmPM(PackageManager):
211 return complementary_pkgs 212 return complementary_pkgs
212 except subprocess.CalledProcessError as e: 213 except subprocess.CalledProcessError as e:
213 bb.fatal("Could not invoke smart. Command " 214 bb.fatal("Could not invoke smart. Command "
214 "%s returned %d!" % (cmd, e.returncode)) 215 "'%s' returned %d:\n%s" % (cmd, e.returncode, e.output))
215 216
216 ''' 217 '''
217 Translate the RPM/Smart format names to the OE multilib format names 218 Translate the RPM/Smart format names to the OE multilib format names
@@ -390,8 +391,8 @@ class RpmPM(PackageManager):
390 try: 391 try:
391 subprocess.check_output(cmd, shell=True) 392 subprocess.check_output(cmd, shell=True)
392 except subprocess.CalledProcessError as e: 393 except subprocess.CalledProcessError as e:
393 bb.fatal("Create rpm database failed. Command %s " 394 bb.fatal("Create rpm database failed. Command '%s' "
394 "returned %d" % (cmd, e.returncode)) 395 "returned %d:\n%s" % (cmd, e.returncode, e.output))
395 396
396 # Configure smart 397 # Configure smart
397 bb.note("configuring Smart settings") 398 bb.note("configuring Smart settings")
@@ -513,8 +514,8 @@ class RpmPM(PackageManager):
513 output = subprocess.check_output(cmd.split()) 514 output = subprocess.check_output(cmd.split())
514 bb.note(output) 515 bb.note(output)
515 except subprocess.CalledProcessError as e: 516 except subprocess.CalledProcessError as e:
516 bb.fatal("Unable to install packages. Command %s " 517 bb.fatal("Unable to install packages. Command '%s' "
517 "returned %d" % (cmd, e.returncode)) 518 "returned %d:\n%s" % (cmd, e.returncode, e.output))
518 519
519 ''' 520 '''
520 Remove pkgs with smart, the pkg name is smart/rpm format 521 Remove pkgs with smart, the pkg name is smart/rpm format
@@ -543,8 +544,8 @@ class RpmPM(PackageManager):
543 output = subprocess.check_output(cmd, shell=True) 544 output = subprocess.check_output(cmd, shell=True)
544 bb.note(output) 545 bb.note(output)
545 except subprocess.CalledProcessError as e: 546 except subprocess.CalledProcessError as e:
546 bb.note("Unable to remove packages. Command %s " 547 bb.note("Unable to remove packages. Command '%s' "
547 "returned %d" % (cmd, e.returncode)) 548 "returned %d:\n%s" % (cmd, e.returncode, e.output))
548 549
549 def upgrade(self): 550 def upgrade(self):
550 bb.note('smart upgrade') 551 bb.note('smart upgrade')
@@ -623,8 +624,8 @@ class RpmPM(PackageManager):
623 tmp_output = subprocess.check_output(cmd, shell=True).strip() 624 tmp_output = subprocess.check_output(cmd, shell=True).strip()
624 self._unlock_rpm_db() 625 self._unlock_rpm_db()
625 except subprocess.CalledProcessError as e: 626 except subprocess.CalledProcessError as e:
626 bb.fatal("Cannot get the installed packages list. Command %s " 627 bb.fatal("Cannot get the installed packages list. Command '%s' "
627 "returned %d" % (cmd, e.returncode)) 628 "returned %d:\n%s" % (cmd, e.returncode, e.output))
628 629
629 output = list() 630 output = list()
630 for line in tmp_output.split('\n'): 631 for line in tmp_output.split('\n'):
@@ -678,8 +679,8 @@ class RpmPM(PackageManager):
678 if '@' in pkg: 679 if '@' in pkg:
679 install_pkgs.append(pkg) 680 install_pkgs.append(pkg)
680 except subprocess.CalledProcessError as e: 681 except subprocess.CalledProcessError as e:
681 bb.note("Unable to dump install packages. Command %s " 682 bb.note("Unable to dump install packages. Command '%s' "
682 "returned %d" % (cmd, e.returncode)) 683 "returned %d:\n%s" % (cmd, e.returncode, e.output))
683 # Recovery rpmsys channel 684 # Recovery rpmsys channel
684 self._invoke_smart('channel --enable rpmsys') 685 self._invoke_smart('channel --enable rpmsys')
685 return install_pkgs 686 return install_pkgs
@@ -720,8 +721,8 @@ class RpmPM(PackageManager):
720 if '@' in pkg: 721 if '@' in pkg:
721 available_pkgs.append(pkg.strip()) 722 available_pkgs.append(pkg.strip())
722 except subprocess.CalledProcessError as e: 723 except subprocess.CalledProcessError as e:
723 bb.note("Unable to list all available packages. Command %s " 724 bb.note("Unable to list all available packages. Command '%s' "
724 "returned %d" % (cmd, e.returncode)) 725 "returned %d:\n%s" % (cmd, e.returncode, e.output))
725 726
726 self.fullpkglist = available_pkgs 727 self.fullpkglist = available_pkgs
727 728
@@ -753,8 +754,8 @@ class RpmPM(PackageManager):
753 os.chmod(saved_dir, 0755) 754 os.chmod(saved_dir, 0755)
754 self._unlock_rpm_db() 755 self._unlock_rpm_db()
755 except subprocess.CalledProcessError as e: 756 except subprocess.CalledProcessError as e:
756 bb.fatal("Invoke save_rpmpostinst failed. Command %s " 757 bb.fatal("Invoke save_rpmpostinst failed. Command '%s' "
757 "returned %d" % (cmd, e.returncode)) 758 "returned %d:\n%s" % (cmd, e.returncode, e.output))
758 759
759 '''Write common configuration for target usage''' 760 '''Write common configuration for target usage'''
760 def rpm_setup_smart_target_config(self): 761 def rpm_setup_smart_target_config(self):
@@ -900,8 +901,8 @@ class OpkgPM(PackageManager):
900 subprocess.check_output(cmd.split()) 901 subprocess.check_output(cmd.split())
901 except subprocess.CalledProcessError as e: 902 except subprocess.CalledProcessError as e:
902 self.deploy_dir_unlock() 903 self.deploy_dir_unlock()
903 bb.fatal("Unable to update the package index files. Command %s " 904 bb.fatal("Unable to update the package index files. Command '%s' "
904 "returned %d" % (cmd, e.returncode)) 905 "returned %d:\n%s" % (cmd, e.returncode, e.output))
905 906
906 self.deploy_dir_unlock() 907 self.deploy_dir_unlock()
907 908
@@ -924,8 +925,8 @@ class OpkgPM(PackageManager):
924 subprocess.check_output(cmd.split()) 925 subprocess.check_output(cmd.split())
925 except subprocess.CalledProcessError as e: 926 except subprocess.CalledProcessError as e:
926 (bb.fatal, bb.note)[attempt_only]("Unable to install packages. " 927 (bb.fatal, bb.note)[attempt_only]("Unable to install packages. "
927 "Command %s returned %d" % 928 "Command '%s' returned %d:\n%s" %
928 (cmd, e.returncode)) 929 (cmd, e.returncode, e.output))
929 930
930 def remove(self, pkgs, with_dependencies=True): 931 def remove(self, pkgs, with_dependencies=True):
931 if with_dependencies: 932 if with_dependencies:
@@ -938,8 +939,8 @@ class OpkgPM(PackageManager):
938 try: 939 try:
939 subprocess.check_output(cmd.split()) 940 subprocess.check_output(cmd.split())
940 except subprocess.CalledProcessError as e: 941 except subprocess.CalledProcessError as e:
941 bb.fatal("Unable to remove packages. Command %s " 942 bb.fatal("Unable to remove packages. Command '%s' "
942 "returned %d" % (e.cmd, e.returncode)) 943 "returned %d:\n%s" % (e.cmd, e.returncode, e.output))
943 944
944 def write_index(self): 945 def write_index(self):
945 arch_vars = ["ALL_MULTILIB_PACKAGE_ARCHS", 946 arch_vars = ["ALL_MULTILIB_PACKAGE_ARCHS",
@@ -1014,8 +1015,8 @@ class OpkgPM(PackageManager):
1014 try: 1015 try:
1015 output = subprocess.check_output(cmd, shell=True).strip() 1016 output = subprocess.check_output(cmd, shell=True).strip()
1016 except subprocess.CalledProcessError as e: 1017 except subprocess.CalledProcessError as e:
1017 bb.fatal("Cannot get the installed packages list. Command %s " 1018 bb.fatal("Cannot get the installed packages list. Command '%s' "
1018 "returned %d" % (cmd, e.returncode)) 1019 "returned %d:\n%s" % (cmd, e.returncode, e.output))
1019 1020
1020 if format == "file": 1021 if format == "file":
1021 tmp_output = "" 1022 tmp_output = ""
@@ -1046,8 +1047,8 @@ class OpkgPM(PackageManager):
1046 try: 1047 try:
1047 output = subprocess.check_output(pkg_info.split()).strip() 1048 output = subprocess.check_output(pkg_info.split()).strip()
1048 except subprocess.CalledProcessError as e: 1049 except subprocess.CalledProcessError as e:
1049 bb.fatal("Cannot get package info. Command %s " 1050 bb.fatal("Cannot get package info. Command '%s' "
1050 "returned %d" % (pkg_info, e.returncode)) 1051 "returned %d:\n%s" % (pkg_info, e.returncode, e.output))
1051 1052
1052 if output == "": 1053 if output == "":
1053 bb.note("Requested ignored recommendation $i is " 1054 bb.note("Requested ignored recommendation $i is "
@@ -1142,8 +1143,8 @@ class DpkgPM(PackageManager):
1142 (suffix[1].lower(), pkg_name)) 1143 (suffix[1].lower(), pkg_name))
1143 subprocess.check_output(p_full) 1144 subprocess.check_output(p_full)
1144 except subprocess.CalledProcessError as e: 1145 except subprocess.CalledProcessError as e:
1145 bb.note("%s for package %s failed with %d" % 1146 bb.note("%s for package %s failed with %d:\n%s" %
1146 (suffix[1], pkg_name, e.returncode)) 1147 (suffix[1], pkg_name, e.returncode, e.output))
1147 failed_pkgs.append(pkg_name) 1148 failed_pkgs.append(pkg_name)
1148 break 1149 break
1149 1150
@@ -1160,8 +1161,8 @@ class DpkgPM(PackageManager):
1160 try: 1161 try:
1161 subprocess.check_output(cmd.split()) 1162 subprocess.check_output(cmd.split())
1162 except subprocess.CalledProcessError as e: 1163 except subprocess.CalledProcessError as e:
1163 bb.fatal("Unable to update the package index files. Command %s " 1164 bb.fatal("Unable to update the package index files. Command '%s' "
1164 "returned %d" % (e.cmd, e.returncode)) 1165 "returned %d:\n%s" % (e.cmd, e.returncode, e.output))
1165 1166
1166 self.deploy_dir_unlock() 1167 self.deploy_dir_unlock()
1167 1168
@@ -1179,8 +1180,8 @@ class DpkgPM(PackageManager):
1179 subprocess.check_output(cmd.split()) 1180 subprocess.check_output(cmd.split())
1180 except subprocess.CalledProcessError as e: 1181 except subprocess.CalledProcessError as e:
1181 (bb.fatal, bb.note)[attempt_only]("Unable to install packages. " 1182 (bb.fatal, bb.note)[attempt_only]("Unable to install packages. "
1182 "Command %s returned %d" % 1183 "Command '%s' returned %d:\n%s" %
1183 (cmd, e.returncode)) 1184 (cmd, e.returncode, e.output))
1184 1185
1185 # rename *.dpkg-new files/dirs 1186 # rename *.dpkg-new files/dirs
1186 for root, dirs, files in os.walk(self.target_rootfs): 1187 for root, dirs, files in os.walk(self.target_rootfs):
@@ -1210,8 +1211,8 @@ class DpkgPM(PackageManager):
1210 try: 1211 try:
1211 subprocess.check_output(cmd.split()) 1212 subprocess.check_output(cmd.split())
1212 except subprocess.CalledProcessError as e: 1213 except subprocess.CalledProcessError as e:
1213 bb.fatal("Unable to remove packages. Command %s " 1214 bb.fatal("Unable to remove packages. Command '%s' "
1214 "returned %d" % (e.cmd, e.returncode)) 1215 "returned %d:\n%s" % (e.cmd, e.returncode, e.output))
1215 1216
1216 def write_index(self): 1217 def write_index(self):
1217 tmpdir = self.d.getVar('TMPDIR', True) 1218 tmpdir = self.d.getVar('TMPDIR', True)
@@ -1328,8 +1329,8 @@ class DpkgPM(PackageManager):
1328 try: 1329 try:
1329 subprocess.check_output(cmd.split()) 1330 subprocess.check_output(cmd.split())
1330 except subprocess.CalledProcessError as e: 1331 except subprocess.CalledProcessError as e:
1331 bb.fatal("Cannot fix broken dependencies. Command %s " 1332 bb.fatal("Cannot fix broken dependencies. Command '%s' "
1332 "returned %d" % (cmd, e.returncode)) 1333 "returned %d:\n%s" % (cmd, e.returncode, e.output))
1333 1334
1334 def list_installed(self, format=None): 1335 def list_installed(self, format=None):
1335 cmd = [bb.utils.which(os.getenv('PATH'), "dpkg-query"), 1336 cmd = [bb.utils.which(os.getenv('PATH'), "dpkg-query"),
@@ -1348,8 +1349,8 @@ class DpkgPM(PackageManager):
1348 try: 1349 try:
1349 output = subprocess.check_output(cmd).strip() 1350 output = subprocess.check_output(cmd).strip()
1350 except subprocess.CalledProcessError as e: 1351 except subprocess.CalledProcessError as e:
1351 bb.fatal("Cannot get the installed packages list. Command %s " 1352 bb.fatal("Cannot get the installed packages list. Command '%s' "
1352 "returned %d" % (' '.join(cmd), e.returncode)) 1353 "returned %d:\n%s" % (' '.join(cmd), e.returncode, e.output))
1353 1354
1354 if format == "file": 1355 if format == "file":
1355 tmp_output = "" 1356 tmp_output = ""