classes/kernel.bbclass: allow disabling symlink creation also for pkg_postinst

Message ID ccb29f6aba164c4fa6ff8a1ae4718c91@garz-fricke.com
State New
Headers show
Series classes/kernel.bbclass: allow disabling symlink creation also for pkg_postinst | expand

Commit Message

Jonas Höppner May 11, 2022, 4:05 p.m. UTC
The commit d7341f1f22c32ff6cc95d7127f26f87d7fc9c6bd has introduced a
variable to disable the symlink creation for kernel images.
kernel.bbclass contains code to generate a pkg_posinst step for the
kernel-image package which will generate a symlink after installation
on target/during rootfs creation. This part didn't checked the
KERNEL_IMAGETYPE_SYMLINK variable.


This patch adds this check, so that it is possible to disable this
symlink also.


Signed-off-by: Jonas Höppner <jonas.hoeppner@garz-fricke.com>
---
 meta/classes/kernel.bbclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Luca Ceresoli May 12, 2022, 8:08 a.m. UTC | #1
Hi Jonas,

Il giorno Wed, 11 May 2022 16:05:39 +0000
"Jonas via lists.openembedded.org"
<jonas.hoeppner=garz-fricke.com@lists.openembedded.org> ha scritto:

> The commit d7341f1f22c32ff6cc95d7127f26f87d7fc9c6bd has introduced a
> variable to disable the symlink creation for kernel images.
> kernel.bbclass contains code to generate a pkg_posinst step for the
> kernel-image package which will generate a symlink after installation
> on target/during rootfs creation. This part didn't checked the
> KERNEL_IMAGETYPE_SYMLINK variable.
> 
> 
> This patch adds this check, so that it is possible to disable this
> symlink also.
> 
> 
> Signed-off-by: Jonas Höppner <jonas.hoeppner@garz-fricke.com>

This patch does not apply, apparently because it is not properly
text-encoded. Did you use git send-email to send it?

Patch

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 8299b394a7..87e0970f00 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -93,6 +93,7 @@  python __anonymous () {
 
     kname = d.getVar('KERNEL_PACKAGE_NAME') or "kernel"
     imagedest = d.getVar('KERNEL_IMAGEDEST')
+    kernel_imagetype_symlink = d.getVar('KERNEL_IMAGETYPE_SYMLINK')
 
     for type in types.split():
         if bb.data.inherits_class('nopackages', d):
@@ -110,7 +111,8 @@  python __anonymous () {
 
         d.setVar('PKG:%s-image-%s' % (kname,typelower), '%s-image-%s-${KERNEL_VERSION_PKG_NAME}' % (kname, typelower))
         d.setVar('ALLOW_EMPTY:%s-image-%s' % (kname, typelower), '1')
-        d.setVar('pkg_postinst:%s-image-%s' % (kname,typelower), """set +e
+        if kernel_imagetype_symlink == 1:
+            d.setVar('pkg_postinst:%s-image-%s' % (kname,typelower), """set +e
 if [ -n "$D" ]; then
     ln -sf %s-${KERNEL_VERSION} $D/${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1
 else
@@ -122,7 +124,7 @@  else
 fi
 set -e
 """ % (type, type, type, type, type, type, type))
-        d.setVar('pkg_postrm:%s-image-%s' % (kname,typelower), """set +e
+            d.setVar('pkg_postrm:%s-image-%s' % (kname,typelower), """set +e
 if [ -f "${KERNEL_IMAGEDEST}/%s" -o -L "${KERNEL_IMAGEDEST}/%s" ]; then
     rm -f ${KERNEL_IMAGEDEST}/%s  > /dev/null 2>&1
 fi