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.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index d7cbbbe652..355ed44553 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -770,7 +770,22 @@ class RpmPM(PackageManager):
770 self.image_rpmlib, 770 self.image_rpmlib,
771 symlinks=True) 771 symlinks=True)
772 772
773 def _list_pkg_deps(self):
774 cmd = [bb.utils.which(os.getenv('PATH'), "rpmresolve"),
775 "-t", self.image_rpmlib]
776
777 try:
778 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).strip()
779 except subprocess.CalledProcessError as e:
780 bb.fatal("Cannot get the package dependencies. Command '%s' "
781 "returned %d:\n%s" % (' '.join(cmd), e.returncode, e.output))
782
783 return output
784
773 def list_installed(self, format=None): 785 def list_installed(self, format=None):
786 if format == "deps":
787 return self._list_pkg_deps()
788
774 cmd = self.rpm_cmd + ' --root ' + self.target_rootfs 789 cmd = self.rpm_cmd + ' --root ' + self.target_rootfs
775 cmd += ' -D "_dbpath /var/lib/rpm" -qa' 790 cmd += ' -D "_dbpath /var/lib/rpm" -qa'
776 cmd += " --qf '[%{NAME} %{ARCH} %{VERSION} %{PACKAGEORIGIN}\n]'" 791 cmd += " --qf '[%{NAME} %{ARCH} %{VERSION} %{PACKAGEORIGIN}\n]'"
@@ -1136,6 +1151,9 @@ class OpkgPM(PackageManager):
1136 elif format == "ver": 1151 elif format == "ver":
1137 cmd = "%s %s status | %s -v" % \ 1152 cmd = "%s %s status | %s -v" % \
1138 (self.opkg_cmd, self.opkg_args, opkg_query_cmd) 1153 (self.opkg_cmd, self.opkg_args, opkg_query_cmd)
1154 elif format == "deps":
1155 cmd = "%s %s status | %s" % \
1156 (self.opkg_cmd, self.opkg_args, opkg_query_cmd)
1139 else: 1157 else:
1140 cmd = "%s %s list_installed | cut -d' ' -f1" % \ 1158 cmd = "%s %s list_installed | cut -d' ' -f1" % \
1141 (self.opkg_cmd, self.opkg_args) 1159 (self.opkg_cmd, self.opkg_args)
@@ -1499,6 +1517,8 @@ class DpkgPM(PackageManager):
1499 cmd.append("-f=${Package} ${Package}_${Version}_${Architecture}.deb ${PackageArch}\n") 1517 cmd.append("-f=${Package} ${Package}_${Version}_${Architecture}.deb ${PackageArch}\n")
1500 elif format == "ver": 1518 elif format == "ver":
1501 cmd.append("-f=${Package} ${PackageArch} ${Version}\n") 1519 cmd.append("-f=${Package} ${PackageArch} ${Version}\n")
1520 elif format == "deps":
1521 cmd.append("-f=Package: ${Package}\nDepends: ${Depends}\nRecommends: ${Recommends}\n\n")
1502 else: 1522 else:
1503 cmd.append("-f=${Package}\n") 1523 cmd.append("-f=${Package}\n")
1504 1524
@@ -1519,6 +1539,17 @@ class DpkgPM(PackageManager):
1519 tmp_output += "%s %s %s\n" % (pkg, pkg_file, pkg_arch) 1539 tmp_output += "%s %s %s\n" % (pkg, pkg_file, pkg_arch)
1520 1540
1521 output = tmp_output 1541 output = tmp_output
1542 elif format == "deps":
1543 opkg_query_cmd = bb.utils.which(os.getenv('PATH'), "opkg-query-helper.py")
1544
1545 try:
1546 output = subprocess.check_output("echo -e '%s' | %s" %
1547 (output, opkg_query_cmd),
1548 stderr=subprocess.STDOUT,
1549 shell=True)
1550 except subprocess.CalledProcessError as e:
1551 bb.fatal("Cannot compute packages dependencies. Command '%s' "
1552 "returned %d:\n%s" % (e.cmd, e.returncode, e.output))
1522 1553
1523 return output 1554 return output
1524 1555