Skip to contentSkip to conversation

kernel.bbclass overwrites custom variables

RFC PATCH New Oliver Stäbler 1 participant 2 messages Aug 21, 2017

lore
Share & tools
lore
#0 lore raw

cover kernel.bbclass overwrites custom variables

Hi

It seems that it's not possible to set a custom pre/postinst function for a kernel recipe.
kernel.bbclass overwrites the necessary variables without checking its content.

My patch does fix this.
However, I'm not sure how to handle similar variables which get overwritten by kernel.bbclass, therefore a RFC.

What about FILES_kernel_image?
A custom recipe should be able to add other files into the kernel package, right?

What about PKG_kernel_image?
I'm not really sure what this variable is used for.

Oliver Stäbler (1):
kernel.bbclass: Do not overwrite pre/postinst

 meta/classes/kernel.bbclass | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
Signature · 1 line
2.13.5
#1 lore raw

RFC PATCH 1/1 kernel.bbclass: Do not overwrite pre/postinst

If a recipe sets a custom pre/postinst function for kernel-image, this function gets discarded, which means there is no possibility to set a custom pre/postinst function.

We check if there is a custom pre/postinst function and only set the default function if nothing is set.

---
 meta/classes/kernel.bbclass | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
meta/classes/kernel.bbclass +6 -4
index 2a765547ac..e553460566 100644
@@ -66,11 +66,13 @@ python __anonymous () {
         d.setVar('ALLOW_EMPTY_kernel-image-' + typelower, '1')
 
         priority = d.getVar('KERNEL_PRIORITY')
-        postinst = '#!/bin/sh\n' + 'update-alternatives --install /' + imagedest + '/' + type + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} ' + priority + ' || true' + '\n'
-        d.setVar('pkg_postinst_kernel-image-' + typelower, postinst)
+        if not d.getVar('pkg_postinst_kernel-image-' + typelower):
+                postinst = '#!/bin/sh\n' + 'update-alternatives --install /' + imagedest + '/' + type + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} ' + priority + ' || true' + '\n'
+                d.setVar('pkg_postinst_kernel-image-' + typelower, postinst)
 
-        postrm = '#!/bin/sh\n' + 'update-alternatives --remove' + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} || true' + '\n'
-        d.setVar('pkg_postrm_kernel-image-' + typelower, postrm)
+        if not d.getVar('pkg_postrm_kernel-image-' + typelower):
+                postrm = '#!/bin/sh\n' + 'update-alternatives --remove' + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} || true' + '\n'
+                d.setVar('pkg_postrm_kernel-image-' + typelower, postrm)
 
     image = d.getVar('INITRAMFS_IMAGE')
     if image:
Signature · 1 line
2.13.5