From: Adrian Freihofer <[email protected]>

Fix the complementary package install logic (oe-pkgdata-util) for
packages which have PACKAGE_BASENAME != PN  (only the kernel).

Add PACKAGE_BASENAME to PKGDATA_VARS so it is recorded in pkgdata like
any other per-package field, and have glob() read it (falling back to
PN, for pkgdata not yet regenerated with the new field) instead of PN
alone.

With this change the kernel -dbg and -src packages are automatically
added to the rootfs-dbg if the kernel is installed in the rootfs.
Removing this kernel packages is possible by
  PACKAGE_EXCLUDE_COMPLEMENTARY += "kernel-*"

Adding the kernel-dbg, -src packges for systems where the kernel is not
installed into the rootfs is possible via IMAGE_INSTALL_DEBUGFS.

Not sure, if there could be a more systaibable fix which would remove
KERNEL_PACKAGE_NAME from the kernel and not need this extra complexity
in the packaging code.

Signed-off-by: Adrian Freihofer <[email protected]>
---
 meta/classes-global/package.bbclass | 2 +-
 scripts/oe-pkgdata-util             | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/meta/classes-global/package.bbclass 
b/meta/classes-global/package.bbclass
index e21350a06f..4ead147cd3 100644
--- a/meta/classes-global/package.bbclass
+++ b/meta/classes-global/package.bbclass
@@ -385,7 +385,7 @@ EXPORT_FUNCTIONS package_name_hook
 
 PKGDESTWORK = "${WORKDIR}/pkgdata"
 
-PKGDATA_VARS = "PN PE PV PR PKGE PKGV PKGR LICENSE DESCRIPTION SUMMARY 
RDEPENDS RPROVIDES RRECOMMENDS RSUGGESTS RREPLACES RCONFLICTS SECTION PKG 
ALLOW_EMPTY FILES CONFFILES FILES_INFO PACKAGE_ADD_METADATA pkg_postinst 
pkg_postrm pkg_preinst pkg_prerm"
+PKGDATA_VARS = "PN PE PV PR PKGE PKGV PKGR LICENSE DESCRIPTION SUMMARY 
RDEPENDS RPROVIDES RRECOMMENDS RSUGGESTS RREPLACES RCONFLICTS SECTION PKG 
ALLOW_EMPTY FILES CONFFILES FILES_INFO PACKAGE_ADD_METADATA PACKAGE_BASENAME 
pkg_postinst pkg_postrm pkg_preinst pkg_prerm"
 
 python emit_pkgdata() {
     import oe.packagedata
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
index acefae24f3..466086f009 100755
--- a/scripts/oe-pkgdata-util
+++ b/scripts/oe-pkgdata-util
@@ -86,11 +86,16 @@ def glob(args):
                 return os.path.join(args.pkgdata_dir, "runtime", pkgn)
             def readpn(pkgdata_file):
                 pn = ""
+                basename = ""
                 with open(pkgdata_file, 'r') as f:
                     for line in f:
                         if line.startswith("PN:"):
                             pn = line.split(': ')[1].rstrip()
-                return pn
+                        elif line.startswith("PACKAGE_BASENAME:"):
+                            basename = line.split(': ')[1].rstrip()
+                # PACKAGE_BASENAME lets a recipe (e.g. via kernel.bbclass's
+                # KERNEL_PACKAGE_NAME) name its sub-packages differently from 
PN
+                return basename or pn
             def readrenamed(pkgdata_file):
                 renamed = ""
                 pn = os.path.basename(pkgdata_file)
-- 
2.55.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#246364): 
https://lists.openembedded.org/g/openembedded-core/message/246364
Mute This Topic: https://lists.openembedded.org/mt/121365624/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to