[master,kirkstone,2/5] lib/oe/rootfs: create image_list_installed_packages_pn function

Message ID 20220628133713.3390786-2-davide.gardenal@huawei.com
State New, archived
Headers show
Series [master,kirkstone,1/5] lib/oe/cve_check: refactor update_symlinks with safer version | expand

Commit Message

Davide Gardenal June 28, 2022, 1:37 p.m. UTC
image_list_installed_packages_pn has been taken from cve-check.bbclass
to make it available for other classes.

Signed-off-by: Davide Gardenal <davide.gardenal@huawei.com>
---
 meta/lib/oe/rootfs.py | 9 +++++++++
 1 file changed, 9 insertions(+)

Patch

diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index 9e6b411fb6..54a356102f 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -393,6 +393,15 @@  def image_list_installed_packages(d, rootfs_dir=None):
     cls = importlib.import_module('oe.package_manager.' + img_type)
     return cls.PMPkgsList(d, rootfs_dir).list_pkgs()
 
+def image_list_installed_packages_pn(d):
+    recipies = set()
+    for pkg in list(image_list_installed_packages(d)):
+        pkg_info = os.path.join(d.getVar('PKGDATA_DIR'),
+                                'runtime-reverse', pkg)
+        pkg_data = oe.packagedata.read_pkgdatafile(pkg_info)
+        recipies.add(pkg_data["PN"])
+    return recipies
+
 if __name__ == "__main__":
     """
     We should be able to run this as a standalone script, from outside bitbake