openembedded-core.lists.openembedded.org archive mirror
 help / color / mirror / Atom feed
* RFC [v3]: Make kernel upgrades via dnf work like on Red Hat
       [not found] <16A93426652F9306.27626@lists.openembedded.org>
@ 2021-09-30 14:14 ` Zoltan Boszormenyi
  2021-09-30 14:14   ` [PATCH v3 1/2] kernel, kernel-module-split: Add runtime dependency to subpackages on main package Zoltan Boszormenyi
  2021-09-30 14:14   ` [PATCH v3 2/2] kernel.bbclass: Allow using update-alternatives for the kernel image Zoltan Boszormenyi
  0 siblings, 2 replies; 5+ messages in thread
From: Zoltan Boszormenyi @ 2021-09-30 14:14 UTC (permalink / raw)
  To: openembedded-core
  Cc: Zoltán Böszörményi, Bruce Ashfield,
	Richard Purdie, Khem Raj

I have observed two issues when upgrading kernel versions
successively.

One is that when installonly_limit is reached in dnf, only the
main kernel package was removed. Patch 1 fixes this by adding
extra RDEPENDS to the kernel subpackages on the main kernel package.
This circular dependency helps package managers to remove all subpackages.
Only rpm packages was build tested, the dependencies are in place for
both 0 and 1 for KERNEL_SPLIT_MODULES. dnf upgrade is doing the
right thing now with removing all subpackages of the oldest
kernel version.

dnf.conf settings "installonlypkgs", "installonly_limit" and
others are documented at https://dnf.readthedocs.io/en/latest/conf_ref.html

The second issue is that when the oldest kernel version is
removed by dnf, the /boot/bzImage symlink is also gone.
It seems that with dnf, postrm of the old version is run later
than postinst of the new one.

Fix this by using update-alternatives instead of hardcoded ln -s
and rm -f. This is configurable via a new variable.

This is still an RFC.

1) The first fix is applied in both cases of KERNEL_SPLIT_MODULES=0 and 1.
   It's applied unconditionally.

2) The new knob name for patch #2 is KERNEL_IMAGEDEST_USE_UPDATE_ALTERNATIVES.
   It is admittedly too chatty, it can be renamed if someone suggests
   a better name.

2) There's an extra issue I found while implementing the second patch:
   even with moving generating the alternative priority value to
   a python function and using a non-expanded substitution, it's
   still expanded during early parsing. The result is thrown away
   so it doesn't cause basehash issues, but still, the function
   needs to protect itself against KERNEL_VERSION being unset.

Please comment.

Best regards,
Zoltán Böszörményi



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3 1/2] kernel, kernel-module-split: Add runtime dependency to subpackages on main package
  2021-09-30 14:14 ` RFC [v3]: Make kernel upgrades via dnf work like on Red Hat Zoltan Boszormenyi
@ 2021-09-30 14:14   ` Zoltan Boszormenyi
  2021-10-05 10:18     ` [OE-core] " Alexandre Belloni
  2021-09-30 14:14   ` [PATCH v3 2/2] kernel.bbclass: Allow using update-alternatives for the kernel image Zoltan Boszormenyi
  1 sibling, 1 reply; 5+ messages in thread
From: Zoltan Boszormenyi @ 2021-09-30 14:14 UTC (permalink / raw)
  To: openembedded-core
  Cc: Zoltán Böszörményi, Bruce Ashfield,
	Richard Purdie, Khem Raj

From: Zoltán Böszörményi <zboszor@gmail.com>

This creates a circular dependency between the main kernel package
and its subpackages. It helps package managers to automatically
remove all kernel packages of the same version when upgrading.

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
---
v2: No changes

v3: Add reverse RDEPENDS to subpackages unconditionally
    Handle KERNEL_SPLIT_MODULES=1 (default) case in
    meta/classes/kernel-module-split.bbclass

 meta/classes/kernel-module-split.bbclass | 5 +++--
 meta/classes/kernel.bbclass              | 7 ++++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass
index a29c294810..2ddcea538c 100644
--- a/meta/classes/kernel-module-split.bbclass
+++ b/meta/classes/kernel-module-split.bbclass
@@ -176,8 +176,9 @@ python split_kernel_module_packages () {
     module_pattern = module_pattern_prefix + kernel_package_name + '-module-%s' + module_pattern_suffix
 
     modules = do_split_packages(d, root='${nonarch_base_libdir}/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='%s-%s' % (kernel_package_name, kernel_version))
-    if modules:
-        d.appendVar('RDEPENDS:' + metapkg, ' '+' '.join(modules))
+    for mod in modules:
+        d.appendVar('RDEPENDS:' + metapkg, ' %s (= ${EXTENDPKGV})' % mod)
+        d.appendVar('RDEPENDS:' + mod, ' %s (= ${EXTENDPKGV})' % kernel_package_name)
 
     # If modules-load.d and modprobe.d are empty at this point, remove them to
     # avoid warnings. removedirs only raises an OSError if an empty
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 4acec1877e..afd9f8045e 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -98,7 +98,9 @@ python __anonymous () {
         typelower = type.lower()
         d.appendVar('PACKAGES', ' %s-image-%s' % (kname, typelower))
         d.setVar('FILES:' + kname + '-image-' + typelower, '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME}' + ' /' + imagedest + '/' + type)
+        d.appendVar('RDEPENDS:%s-image' % kname, ' %s (= ${EXTENDPKGV})' % kname)
         d.appendVar('RDEPENDS:%s-image' % kname, ' %s-image-%s (= ${EXTENDPKGV})' % (kname, typelower))
+        d.appendVar('RDEPENDS:%s-image-%s' % (kname, typelower), ' %s (= ${EXTENDPKGV})' % kname)
         splitmods = d.getVar("KERNEL_SPLIT_MODULES")
         if splitmods != '1':
             d.appendVar('RDEPENDS:%s-image' % kname, ' %s-modules (= ${EXTENDPKGV})' % kname)
@@ -627,8 +629,11 @@ RDEPENDS:${KERNEL_PACKAGE_NAME} = "${KERNEL_PACKAGE_NAME}-base (= ${EXTENDPKGV})
 # Allow machines to override this dependency if kernel image files are
 # not wanted in images as standard
 RDEPENDS:${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image (= ${EXTENDPKGV})"
+RDEPENDS:${KERNEL_PACKAGE_NAME}-base:append = " ${KERNEL_PACKAGE_NAME} (= ${EXTENDPKGV})"
 PKG:${KERNEL_PACKAGE_NAME}-image = "${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}"
-RDEPENDS:${KERNEL_PACKAGE_NAME}-image += "${@oe.utils.conditional('KERNEL_IMAGETYPE', 'vmlinux', '${KERNEL_PACKAGE_NAME}-vmlinux (= ${EXTENDPKGV})', '', d)}"
+RDEPENDS:${KERNEL_PACKAGE_NAME}-image:append = "${@oe.utils.conditional('KERNEL_IMAGETYPE', 'vmlinux', ' ${KERNEL_PACKAGE_NAME}-vmlinux (= ${EXTENDPKGV})', '', d)}"
+RDEPENDS:${KERNEL_PACKAGE_NAME}-vmlinux:append = "${@oe.utils.conditional('KERNEL_IMAGETYPE', 'vmlinux', ' ${KERNEL_PACKAGE_NAME} (= ${EXTENDPKGV})', '', d)}"
+RDEPENDS:${KERNEL_PACKAGE_NAME}-modules:append = " ${KERNEL_PACKAGE_NAME} (= ${EXTENDPKGV})"
 PKG:${KERNEL_PACKAGE_NAME}-base = "${KERNEL_PACKAGE_NAME}-${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}"
 RPROVIDES:${KERNEL_PACKAGE_NAME}-base += "${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}"
 ALLOW_EMPTY:${KERNEL_PACKAGE_NAME} = "1"
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 2/2] kernel.bbclass: Allow using update-alternatives for the kernel image
  2021-09-30 14:14 ` RFC [v3]: Make kernel upgrades via dnf work like on Red Hat Zoltan Boszormenyi
  2021-09-30 14:14   ` [PATCH v3 1/2] kernel, kernel-module-split: Add runtime dependency to subpackages on main package Zoltan Boszormenyi
@ 2021-09-30 14:14   ` Zoltan Boszormenyi
  1 sibling, 0 replies; 5+ messages in thread
From: Zoltan Boszormenyi @ 2021-09-30 14:14 UTC (permalink / raw)
  To: openembedded-core
  Cc: Zoltán Böszörményi, Bruce Ashfield,
	Richard Purdie, Khem Raj

From: Zoltán Böszörményi <zboszor@gmail.com>

When using dnf to install new kernel versions and installonly_limit
is reached, dnf automatically removes the oldest kernel version.
For the dnf.conf documentation on installonlypkgs, installonly_limit
and others settings, see:
https://dnf.readthedocs.io/en/latest/conf_ref.html

When this happens, the kernel image symlink is removed because
1) the postrm script uses rm -f /boot/<image-type> and
2) postrm for the old version is run later than postinst of
   the new one with dnf.

Obviously, it makes the system fail to boot the next time.
Theoretically, this may happen for any package manager.

Allow using the alternative symlink machinery so the highest
kernel version takes precedence and the symlink always stays
in place. This depends on the new variable called
KERNEL_IMAGEDEST_USE_UPDATE_ALTERNATIVES. If it's set to non-0
then update-alternatives is used. Default is 0.

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
---
v2: Mention dnf.conf documentation link
    Protect against "IndexError: list index out of range"

v3: Make update-alternatives --install work for do_rootfs
    Move constructing alternative priority to a python function
    Fix indentation of postinst/postrm scripts

 meta/classes/kernel.bbclass | 39 +++++++++++++++++++++++++++----------
 1 file changed, 29 insertions(+), 10 deletions(-)

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index afd9f8045e..40f3361053 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -42,6 +42,16 @@ KERNEL_VERSION_NAME[vardepvalue] = "${LINUX_VERSION}"
 KERNEL_VERSION_PKG_NAME = "${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}"
 KERNEL_VERSION_PKG_NAME[vardepvalue] = "${LINUX_VERSION}"
 
+def kernel_alternative_priority(d):
+    import re
+    kver =  d.getVar("KERNEL_VERSION")
+    kverp = re.compile('[\.-]')
+    kvparts = kverp.split(kver)
+    if len(kvparts) >= 3:
+        return str(kvparts[0])+str(kvparts[1]).zfill(2)+str(kvparts[2]).zfill(3)
+    else:
+        return "000000"
+
 python __anonymous () {
     pn = d.getVar("PN")
     kpn = d.getVar("KERNEL_PACKAGE_NAME")
@@ -111,23 +121,31 @@ 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 [ -n "$D" ]; then
-    ln -sf %s-${KERNEL_VERSION} $D/${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1
+if [ "${KERNEL_IMAGEDEST_USE_UPDATE_ALTERNATIVES}" != "0" ]; then
+    update-alternatives --install /${KERNEL_IMAGEDEST}/%s %s %s-${KERNEL_VERSION_NAME} ${@kernel_alternative_priority(d)}
 else
-    ln -sf %s-${KERNEL_VERSION} ${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1
-    if [ $? -ne 0 ]; then
-        echo "Filesystem on ${KERNEL_IMAGEDEST}/ doesn't support symlinks, falling back to copied image (%s)."
-        install -m 0644 ${KERNEL_IMAGEDEST}/%s-${KERNEL_VERSION} ${KERNEL_IMAGEDEST}/%s
+    if [ -n "$D" ]; then
+        ln -sf %s-${KERNEL_VERSION} $D/${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1
+    else
+        ln -sf %s-${KERNEL_VERSION} ${KERNEL_IMAGEDEST}/%s > /dev/null 2>&1
+        if [ $? -ne 0 ]; then
+            echo "Filesystem on ${KERNEL_IMAGEDEST}/ doesn't support symlinks, falling back to copied image (%s)."
+            install -m 0644 ${KERNEL_IMAGEDEST}/%s-${KERNEL_VERSION} ${KERNEL_IMAGEDEST}/%s
+        fi
     fi
 fi
 set -e
-""" % (type, type, type, type, type, type, type))
+""" % (type, type, type, type, type, type, type, type, type, type))
         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
+if [ "${KERNEL_IMAGEDEST_USE_UPDATE_ALTERNATIVES}" != "0" ]; then
+    update-alternatives --remove %s %s-${KERNEL_VERSION_NAME}
+else
+    if [ -f "${KERNEL_IMAGEDEST}/%s" -o -L "${KERNEL_IMAGEDEST}/%s" ]; then
+        rm -f ${KERNEL_IMAGEDEST}/%s  > /dev/null 2>&1
+    fi
 fi
 set -e
-""" % (type, type, type))
+""" % (type, type, type, type, type))
 
 
     image = d.getVar('INITRAMFS_IMAGE')
@@ -208,6 +226,7 @@ KERNEL_RELEASE ?= "${KERNEL_VERSION}"
 # The directory where built kernel lies in the kernel tree
 KERNEL_OUTPUT_DIR ?= "arch/${ARCH}/boot"
 KERNEL_IMAGEDEST ?= "boot"
+KERNEL_IMAGEDEST_USE_UPDATE_ALTERNATIVES ?= "0"
 
 #
 # configuration
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [OE-core] [PATCH v3 1/2] kernel, kernel-module-split: Add runtime dependency to subpackages on main package
  2021-09-30 14:14   ` [PATCH v3 1/2] kernel, kernel-module-split: Add runtime dependency to subpackages on main package Zoltan Boszormenyi
@ 2021-10-05 10:18     ` Alexandre Belloni
  2021-10-05 11:02       ` Zoltan Boszormenyi
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandre Belloni @ 2021-10-05 10:18 UTC (permalink / raw)
  To: zboszor
  Cc: openembedded-core, Zoltán Böszörményi,
	Bruce Ashfield, Richard Purdie, Khem Raj

Hello,

On 30/09/2021 16:14:43+0200, Zoltan Boszormenyi via lists.openembedded.org wrote:
> From: Zoltán Böszörményi <zboszor@gmail.com>
> 
> This creates a circular dependency between the main kernel package
> and its subpackages. It helps package managers to automatically
> remove all kernel packages of the same version when upgrading.
> 
> Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
> ---
> v2: No changes
> 
> v3: Add reverse RDEPENDS to subpackages unconditionally
>     Handle KERNEL_SPLIT_MODULES=1 (default) case in
>     meta/classes/kernel-module-split.bbclass
> 
>  meta/classes/kernel-module-split.bbclass | 5 +++--
>  meta/classes/kernel.bbclass              | 7 ++++++-
>  2 files changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass
> index a29c294810..2ddcea538c 100644
> --- a/meta/classes/kernel-module-split.bbclass
> +++ b/meta/classes/kernel-module-split.bbclass
> @@ -176,8 +176,9 @@ python split_kernel_module_packages () {
>      module_pattern = module_pattern_prefix + kernel_package_name + '-module-%s' + module_pattern_suffix
>  
>      modules = do_split_packages(d, root='${nonarch_base_libdir}/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='%s-%s' % (kernel_package_name, kernel_version))
> -    if modules:
> -        d.appendVar('RDEPENDS:' + metapkg, ' '+' '.join(modules))
> +    for mod in modules:
> +        d.appendVar('RDEPENDS:' + metapkg, ' %s (= ${EXTENDPKGV})' % mod)
> +        d.appendVar('RDEPENDS:' + mod, ' %s (= ${EXTENDPKGV})' % kernel_package_name)
>  

I believe this causes the following issues:

https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/4135/steps/18/logs/stdio

Error: 
 Problem: package hello-mod-0.1-r0.qemux86_64 requires kernel-module-hello-5.14.6-yocto-standard = 0.1-r0, but none of the providers can be installed

https://autobuilder.yoctoproject.org/typhoon/#/builders/82/builds/2342/steps/11/logs/stdio

Error: 
 Problem: package lttng-tools-ptest-2.13.0-r0.cortexa57 requires lttng-modules, but none of the providers can be installed
  - package lttng-modules-2.13.0-r0.qemuarm64 requires kernel-module-lttng-wrapper-5.14.6-yocto-standard = 2.13.0-r0, but none of the providers can be installed
  - conflicting requests
  - nothing provides kernel = 2.13.0-r0 needed by kernel-module-lttng-wrapper-5.14.6-yocto-standard-2.13.0-r0.qemuarm64
(try to add '--skip-broken' to skip uninstallable packages)


>      # If modules-load.d and modprobe.d are empty at this point, remove them to
>      # avoid warnings. removedirs only raises an OSError if an empty
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index 4acec1877e..afd9f8045e 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -98,7 +98,9 @@ python __anonymous () {
>          typelower = type.lower()
>          d.appendVar('PACKAGES', ' %s-image-%s' % (kname, typelower))
>          d.setVar('FILES:' + kname + '-image-' + typelower, '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME}' + ' /' + imagedest + '/' + type)
> +        d.appendVar('RDEPENDS:%s-image' % kname, ' %s (= ${EXTENDPKGV})' % kname)
>          d.appendVar('RDEPENDS:%s-image' % kname, ' %s-image-%s (= ${EXTENDPKGV})' % (kname, typelower))
> +        d.appendVar('RDEPENDS:%s-image-%s' % (kname, typelower), ' %s (= ${EXTENDPKGV})' % kname)
>          splitmods = d.getVar("KERNEL_SPLIT_MODULES")
>          if splitmods != '1':
>              d.appendVar('RDEPENDS:%s-image' % kname, ' %s-modules (= ${EXTENDPKGV})' % kname)
> @@ -627,8 +629,11 @@ RDEPENDS:${KERNEL_PACKAGE_NAME} = "${KERNEL_PACKAGE_NAME}-base (= ${EXTENDPKGV})
>  # Allow machines to override this dependency if kernel image files are
>  # not wanted in images as standard
>  RDEPENDS:${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image (= ${EXTENDPKGV})"
> +RDEPENDS:${KERNEL_PACKAGE_NAME}-base:append = " ${KERNEL_PACKAGE_NAME} (= ${EXTENDPKGV})"
>  PKG:${KERNEL_PACKAGE_NAME}-image = "${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}"
> -RDEPENDS:${KERNEL_PACKAGE_NAME}-image += "${@oe.utils.conditional('KERNEL_IMAGETYPE', 'vmlinux', '${KERNEL_PACKAGE_NAME}-vmlinux (= ${EXTENDPKGV})', '', d)}"
> +RDEPENDS:${KERNEL_PACKAGE_NAME}-image:append = "${@oe.utils.conditional('KERNEL_IMAGETYPE', 'vmlinux', ' ${KERNEL_PACKAGE_NAME}-vmlinux (= ${EXTENDPKGV})', '', d)}"
> +RDEPENDS:${KERNEL_PACKAGE_NAME}-vmlinux:append = "${@oe.utils.conditional('KERNEL_IMAGETYPE', 'vmlinux', ' ${KERNEL_PACKAGE_NAME} (= ${EXTENDPKGV})', '', d)}"
> +RDEPENDS:${KERNEL_PACKAGE_NAME}-modules:append = " ${KERNEL_PACKAGE_NAME} (= ${EXTENDPKGV})"
>  PKG:${KERNEL_PACKAGE_NAME}-base = "${KERNEL_PACKAGE_NAME}-${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}"
>  RPROVIDES:${KERNEL_PACKAGE_NAME}-base += "${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}"
>  ALLOW_EMPTY:${KERNEL_PACKAGE_NAME} = "1"
> -- 
> 2.31.1
> 

> 
> 
> 


-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [OE-core] [PATCH v3 1/2] kernel, kernel-module-split: Add runtime dependency to subpackages on main package
  2021-10-05 10:18     ` [OE-core] " Alexandre Belloni
@ 2021-10-05 11:02       ` Zoltan Boszormenyi
  0 siblings, 0 replies; 5+ messages in thread
From: Zoltan Boszormenyi @ 2021-10-05 11:02 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: openembedded-core, Zoltán Böszörményi,
	Bruce Ashfield, Richard Purdie, Khem Raj

On 2021. 10. 05. 12:18, Alexandre Belloni wrote:
> Hello,
> 
> On 30/09/2021 16:14:43+0200, Zoltan Boszormenyi via lists.openembedded.org wrote:
>> From: Zoltán Böszörményi <zboszor@gmail.com>
>>
>> This creates a circular dependency between the main kernel package
>> and its subpackages. It helps package managers to automatically
>> remove all kernel packages of the same version when upgrading.
>>
>> Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
>> ---
>> v2: No changes
>>
>> v3: Add reverse RDEPENDS to subpackages unconditionally
>>      Handle KERNEL_SPLIT_MODULES=1 (default) case in
>>      meta/classes/kernel-module-split.bbclass
>>
>>   meta/classes/kernel-module-split.bbclass | 5 +++--
>>   meta/classes/kernel.bbclass              | 7 ++++++-
>>   2 files changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass
>> index a29c294810..2ddcea538c 100644
>> --- a/meta/classes/kernel-module-split.bbclass
>> +++ b/meta/classes/kernel-module-split.bbclass
>> @@ -176,8 +176,9 @@ python split_kernel_module_packages () {
>>       module_pattern = module_pattern_prefix + kernel_package_name + '-module-%s' + module_pattern_suffix
>>   
>>       modules = do_split_packages(d, root='${nonarch_base_libdir}/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='%s-%s' % (kernel_package_name, kernel_version))
>> -    if modules:
>> -        d.appendVar('RDEPENDS:' + metapkg, ' '+' '.join(modules))
>> +    for mod in modules:
>> +        d.appendVar('RDEPENDS:' + metapkg, ' %s (= ${EXTENDPKGV})' % mod)
>> +        d.appendVar('RDEPENDS:' + mod, ' %s (= ${EXTENDPKGV})' % kernel_package_name)
>>   
> 
> I believe this causes the following issues:
> 
> https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/4135/steps/18/logs/stdio
> 
> Error:
>   Problem: package hello-mod-0.1-r0.qemux86_64 requires kernel-module-hello-5.14.6-yocto-standard = 0.1-r0, but none of the providers can be installed
> 
> https://autobuilder.yoctoproject.org/typhoon/#/builders/82/builds/2342/steps/11/logs/stdio
> 
> Error:
>   Problem: package lttng-tools-ptest-2.13.0-r0.cortexa57 requires lttng-modules, but none of the providers can be installed
>    - package lttng-modules-2.13.0-r0.qemuarm64 requires kernel-module-lttng-wrapper-5.14.6-yocto-standard = 2.13.0-r0, but none of the providers can be installed
>    - conflicting requests
>    - nothing provides kernel = 2.13.0-r0 needed by kernel-module-lttng-wrapper-5.14.6-yocto-standard-2.13.0-r0.qemuarm64
> (try to add '--skip-broken' to skip uninstallable packages)

Arrggh. Externally built modules?

That exact ${EXTENDPKGV} match was intended only for
the kernel and its own modules.

An extra opt-out knob should be devised to be used
by such individual module recipes because their
full version may not match the kernel's.

> 
> 
>>       # If modules-load.d and modprobe.d are empty at this point, remove them to
>>       # avoid warnings. removedirs only raises an OSError if an empty
>> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
>> index 4acec1877e..afd9f8045e 100644
>> --- a/meta/classes/kernel.bbclass
>> +++ b/meta/classes/kernel.bbclass
>> @@ -98,7 +98,9 @@ python __anonymous () {
>>           typelower = type.lower()
>>           d.appendVar('PACKAGES', ' %s-image-%s' % (kname, typelower))
>>           d.setVar('FILES:' + kname + '-image-' + typelower, '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME}' + ' /' + imagedest + '/' + type)
>> +        d.appendVar('RDEPENDS:%s-image' % kname, ' %s (= ${EXTENDPKGV})' % kname)
>>           d.appendVar('RDEPENDS:%s-image' % kname, ' %s-image-%s (= ${EXTENDPKGV})' % (kname, typelower))
>> +        d.appendVar('RDEPENDS:%s-image-%s' % (kname, typelower), ' %s (= ${EXTENDPKGV})' % kname)
>>           splitmods = d.getVar("KERNEL_SPLIT_MODULES")
>>           if splitmods != '1':
>>               d.appendVar('RDEPENDS:%s-image' % kname, ' %s-modules (= ${EXTENDPKGV})' % kname)
>> @@ -627,8 +629,11 @@ RDEPENDS:${KERNEL_PACKAGE_NAME} = "${KERNEL_PACKAGE_NAME}-base (= ${EXTENDPKGV})
>>   # Allow machines to override this dependency if kernel image files are
>>   # not wanted in images as standard
>>   RDEPENDS:${KERNEL_PACKAGE_NAME}-base ?= "${KERNEL_PACKAGE_NAME}-image (= ${EXTENDPKGV})"
>> +RDEPENDS:${KERNEL_PACKAGE_NAME}-base:append = " ${KERNEL_PACKAGE_NAME} (= ${EXTENDPKGV})"
>>   PKG:${KERNEL_PACKAGE_NAME}-image = "${KERNEL_PACKAGE_NAME}-image-${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}"
>> -RDEPENDS:${KERNEL_PACKAGE_NAME}-image += "${@oe.utils.conditional('KERNEL_IMAGETYPE', 'vmlinux', '${KERNEL_PACKAGE_NAME}-vmlinux (= ${EXTENDPKGV})', '', d)}"
>> +RDEPENDS:${KERNEL_PACKAGE_NAME}-image:append = "${@oe.utils.conditional('KERNEL_IMAGETYPE', 'vmlinux', ' ${KERNEL_PACKAGE_NAME}-vmlinux (= ${EXTENDPKGV})', '', d)}"
>> +RDEPENDS:${KERNEL_PACKAGE_NAME}-vmlinux:append = "${@oe.utils.conditional('KERNEL_IMAGETYPE', 'vmlinux', ' ${KERNEL_PACKAGE_NAME} (= ${EXTENDPKGV})', '', d)}"
>> +RDEPENDS:${KERNEL_PACKAGE_NAME}-modules:append = " ${KERNEL_PACKAGE_NAME} (= ${EXTENDPKGV})"
>>   PKG:${KERNEL_PACKAGE_NAME}-base = "${KERNEL_PACKAGE_NAME}-${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}"
>>   RPROVIDES:${KERNEL_PACKAGE_NAME}-base += "${KERNEL_PACKAGE_NAME}-${KERNEL_VERSION}"
>>   ALLOW_EMPTY:${KERNEL_PACKAGE_NAME} = "1"
>> -- 
>> 2.31.1
>>
> 
>>
>>
>>
> 
> 
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-10-05 11:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <16A93426652F9306.27626@lists.openembedded.org>
2021-09-30 14:14 ` RFC [v3]: Make kernel upgrades via dnf work like on Red Hat Zoltan Boszormenyi
2021-09-30 14:14   ` [PATCH v3 1/2] kernel, kernel-module-split: Add runtime dependency to subpackages on main package Zoltan Boszormenyi
2021-10-05 10:18     ` [OE-core] " Alexandre Belloni
2021-10-05 11:02       ` Zoltan Boszormenyi
2021-09-30 14:14   ` [PATCH v3 2/2] kernel.bbclass: Allow using update-alternatives for the kernel image Zoltan Boszormenyi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).