Skip to contentSkip to conversation

package: add extra_recommends to do_split_package()

PATCH In review Ross Burton 5 participants 10 messages Feb 9, 2022 – Feb 10, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package: add extra_recommends to do_split_package()

It may be preferrable to add RRECOMMENDS instead of RDEPENDS to each of the split packages, so add extra_recommends to do this.

---
 meta/classes/package.bbclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
meta/classes/package.bbclass +5 -1
index f4a661ba25a..2143abca0d1 100644
@@ -79,7 +79,7 @@ def legitimize_package_name(s):
     # Remaining package name validity fixes
     return s.lower().replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-')
 
-def do_split_packages(d, root, file_regex, output_pattern, description, postinst=None, recursive=False, hook=None, extra_depends=None, aux_files_pattern=None, postrm=None, allow_dirs=False, prepend=False, match_path=False, aux_files_pattern_verbatim=None, allow_links=False, summary=None):
+def do_split_packages(d, root, file_regex, output_pattern, description, postinst=None, recursive=False, hook=None, extra_depends=None, extra_recommends=None, aux_files_pattern=None, postrm=None, allow_dirs=False, prepend=False, match_path=False, aux_files_pattern_verbatim=None, allow_links=False, summary=None):
     """
     Used in .bb files to split up dynamically generated subpackages of a
     given package, usually plugins or modules.
@@ -108,6 +108,8 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst
                       all packages. The default value of None causes a
                       dependency on the main package (${PN}) - if you do
                       not want this, pass '' for this parameter.
+    extra_recommends -- extra runtime recommends (RRECOMMENDS) to be set for
+                      all packages. By default no recommends are added.
     aux_files_pattern -- extra item(s) to be added to FILES for each
                       package. Can be a single string item or a list of
                       strings for multiple items.  Must include %s.
@@ -222,6 +224,8 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst
             d.setVar('FILES:' + pkg, oldfiles + " " + newfile)
         if extra_depends != '':
             d.appendVar('RDEPENDS:' + pkg, ' ' + extra_depends)
+        if extra_recommends:
+            d.appendVar('RRECOMMENDS:' + pkg, ' ' + extra_recommends)
         if not d.getVar('DESCRIPTION:' + pkg):
             d.setVar('DESCRIPTION:' + pkg, description % on)
         if not d.getVar('SUMMARY:' + pkg):
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 kernel-module-split: modules should recommend the kernel image

Currently each split-out kernel module RDEPENDS on the top-level kernel package (e.g. kernel-5.15-yocto-standard). Whilst at first this seems correct, as modules obviously need their matching kernel, there are many situations where the kernel is provided out-of-band and forcing the kernel in via RDEPENDS in the wrong thing to do, for example an initramfs really shouldn't contain a kernel image, but can contain kernel modules.

Change the module splitting logic to use RRECOMMENDS instead of RDEPENDS, and tighten the dependency to kernel-image instead of kernel to pull in just the image, which also means PACKAGE_EXCLUDE = "kernel-image-*" is sufficient to ensure the image doesn't get pulled into an image.

---
 meta/classes/kernel-module-split.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/kernel-module-split.bbclass +1 -1
index a29c294810e..4429fee4b51 100644
@@ -175,7 +175,7 @@ python split_kernel_module_packages () {
     module_pattern_suffix = d.getVar('KERNEL_MODULE_PACKAGE_SUFFIX')
     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))
+    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_recommends='%s-image-%s' % (kernel_package_name, kernel_version))
     if modules:
         d.appendVar('RDEPENDS:' + metapkg, ' '+' '.join(modules))
 
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH 2/2] kernel-module-split: modules should recommend the kernel image

Quoted 9 lines · Ross Burton

Currently each split-out kernel module RDEPENDS on the top-level kernel package (e.g. kernel-5.15-yocto-standard). Whilst at first this seems correct, as modules obviously need their matching kernel, there are many situations where the kernel is provided out-of-band and forcing the kernel in via RDEPENDS in the wrong thing to do, for example an initramfs really shouldn't contain a kernel image, but can contain kernel modules.

Quoted 6 lines

Change the module splitting logic to use RRECOMMENDS instead of RDEPENDS, and tighten the dependency to kernel-image instead of kernel to pull in just the image, which also means PACKAGE_EXCLUDE = "kernel-image-*" is sufficient to ensure the image doesn't get pulled into an image.

As much as I hate to suggest it, I think the strength of the image dependency needs to be configurable. I know of situations were rrecommends are disabled AND they use quite a few out of tree modules. While I can't say that they are counting on RDEPENDS heavily in this situation, I also can't rule it out .. so this is a breaking change in behaviour for those configurations.

That being said, if RP doesn't want/like a conditional at this particular spot, I can understand that as well .. and am happy to be ignored in that case :)

Bruce

Quoted 19 lines
---
 meta/classes/kernel-module-split.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/kernel-module-split.bbclass +1 -2
index a29c294810e..4429fee4b51 100644
@@ -175,7 +175,7 @@ python split_kernel_module_packages () {
     module_pattern_suffix = d.getVar('KERNEL_MODULE_PACKAGE_SUFFIX')
     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))
+    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_recommends='%s-image-%s' % (kernel_package_name, kernel_version))
     if modules:
         d.appendVar('RDEPENDS:' + metapkg, ' '+' '.join(modules))
 
--
Quoted 2 lines

2.25.1

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

#3 lore raw

Re: [OE-core] [PATCH 2/2] kernel-module-split: modules should recommend the kernel image

Quoted 25 lines · Bruce Ashfield
Quoted 9 lines · Ross Burton

Currently each split-out kernel module RDEPENDS on the top-level kernel package (e.g. kernel-5.15-yocto-standard). Whilst at first this seems correct, as modules obviously need their matching kernel, there are many situations where the kernel is provided out-of-band and forcing the kernel in via RDEPENDS in the wrong thing to do, for example an initramfs really shouldn't contain a kernel image, but can contain kernel modules.

Quoted 6 lines

Change the module splitting logic to use RRECOMMENDS instead of RDEPENDS, and tighten the dependency to kernel-image instead of kernel to pull in just the image, which also means PACKAGE_EXCLUDE = "kernel-image-*" is sufficient to ensure the image doesn't get pulled into an image.

As much as I hate to suggest it, I think the strength of the image dependency needs to be configurable. I know of situations were rrecommends are disabled AND they use quite a few out of tree modules. While I can't say that they are counting on RDEPENDS heavily in this situation, I also can't rule it out .. so this is a breaking change in behaviour for those configurations.

Quoted 3 lines

That being said, if RP doesn't want/like a conditional at this particular spot, I can understand that as well .. and am happy to be ignored in that case :)

I see that this change eases container image generation. I would be inclined to support this change.

Quoted 39 lines

Bruce

Quoted 19 lines
---
 meta/classes/kernel-module-split.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/kernel-module-split.bbclass +1 -2
index a29c294810e..4429fee4b51 100644
@@ -175,7 +175,7 @@ python split_kernel_module_packages () {
     module_pattern_suffix = d.getVar('KERNEL_MODULE_PACKAGE_SUFFIX')
     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))
+    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_recommends='%s-image-%s' % (kernel_package_name, kernel_version))
     if modules:
         d.appendVar('RDEPENDS:' + metapkg, ' '+' '.join(modules))
 
--
Quoted 2 lines

2.25.1

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

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

#4 lore raw

Re: [OE-core] [PATCH 2/2] kernel-module-split: modules should recommend the kernel image

Quoted 27 lines · Khem Raj
Quoted 25 lines · Bruce Ashfield
Quoted 9 lines · Ross Burton

Currently each split-out kernel module RDEPENDS on the top-level kernel package (e.g. kernel-5.15-yocto-standard). Whilst at first this seems correct, as modules obviously need their matching kernel, there are many situations where the kernel is provided out-of-band and forcing the kernel in via RDEPENDS in the wrong thing to do, for example an initramfs really shouldn't contain a kernel image, but can contain kernel modules.

Quoted 6 lines

Change the module splitting logic to use RRECOMMENDS instead of RDEPENDS, and tighten the dependency to kernel-image instead of kernel to pull in just the image, which also means PACKAGE_EXCLUDE = "kernel-image-*" is sufficient to ensure the image doesn't get pulled into an image.

As much as I hate to suggest it, I think the strength of the image dependency needs to be configurable. I know of situations were rrecommends are disabled AND they use quite a few out of tree modules. While I can't say that they are counting on RDEPENDS heavily in this situation, I also can't rule it out .. so this is a breaking change in behaviour for those configurations.

Quoted 6 lines
Quoted 3 lines

That being said, if RP doesn't want/like a conditional at this particular spot, I can understand that as well .. and am happy to be ignored in that case :)

I see that this change eases container image generation. I would be inclined to support this change.

To be clear, i think the change is fine as well .. I'm simply saying, it should be configurable, as we are potential breaking the existing use case for another.

Cheers,

Bruce

Quoted 40 lines
Quoted 40 lines

Bruce

Quoted 19 lines
---
 meta/classes/kernel-module-split.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/kernel-module-split.bbclass +1 -2
index a29c294810e..4429fee4b51 100644
@@ -175,7 +175,7 @@ python split_kernel_module_packages () {
     module_pattern_suffix = d.getVar('KERNEL_MODULE_PACKAGE_SUFFIX')
     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))
+    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_recommends='%s-image-%s' % (kernel_package_name, kernel_version))
     if modules:
         d.appendVar('RDEPENDS:' + metapkg, ' '+' '.join(modules))
 
--
Quoted 2 lines

2.25.1

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

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

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
#5 lore raw

Re: [OE-core] [PATCH 2/2] kernel-module-split: modules should recommend the kernel image

In reply to Bruce Ashfield
Quoted 24 lines · Bruce Ashfield
Quoted 9 lines · Ross Burton

Currently each split-out kernel module RDEPENDS on the top-level kernel package (e.g. kernel-5.15-yocto-standard). Whilst at first this seems correct, as modules obviously need their matching kernel, there are many situations where the kernel is provided out-of-band and forcing the kernel in via RDEPENDS in the wrong thing to do, for example an initramfs really shouldn't contain a kernel image, but can contain kernel modules.

Quoted 6 lines

Change the module splitting logic to use RRECOMMENDS instead of RDEPENDS, and tighten the dependency to kernel-image instead of kernel to pull in just the image, which also means PACKAGE_EXCLUDE = "kernel-image-*" is sufficient to ensure the image doesn't get pulled into an image.

As much as I hate to suggest it, I think the strength of the image dependency needs to be configurable. I know of situations were rrecommends are disabled AND they use quite a few out of tree modules. While I can't say that they are counting on RDEPENDS heavily in this situation, I also can't rule it out .. so this is a breaking change in behaviour for those configurations.

Quoted 3 lines

That being said, if RP doesn't want/like a conditional at this particular spot, I can understand that as well .. and am happy to be ignored in that case :)

Isn't there a case where the main kernel "image" package is empty so you just have to break the dependency at the main image level rather than messing with the modules? or am I half remembering something badly?

Cheers,

Richard

#6 lore raw

Re: [OE-core] [PATCH 2/2] kernel-module-split: modules should recommend the kernel image

Quoted 26 lines · Richard Purdie
Quoted 24 lines · Bruce Ashfield
Quoted 9 lines · Ross Burton

Currently each split-out kernel module RDEPENDS on the top-level kernel package (e.g. kernel-5.15-yocto-standard). Whilst at first this seems correct, as modules obviously need their matching kernel, there are many situations where the kernel is provided out-of-band and forcing the kernel in via RDEPENDS in the wrong thing to do, for example an initramfs really shouldn't contain a kernel image, but can contain kernel modules.

Quoted 6 lines

Change the module splitting logic to use RRECOMMENDS instead of RDEPENDS, and tighten the dependency to kernel-image instead of kernel to pull in just the image, which also means PACKAGE_EXCLUDE = "kernel-image-*" is sufficient to ensure the image doesn't get pulled into an image.

As much as I hate to suggest it, I think the strength of the image dependency needs to be configurable. I know of situations were rrecommends are disabled AND they use quite a few out of tree modules. While I can't say that they are counting on RDEPENDS heavily in this situation, I also can't rule it out .. so this is a breaking change in behaviour for those configurations.

Quoted 7 lines
Quoted 3 lines

That being said, if RP doesn't want/like a conditional at this particular spot, I can understand that as well .. and am happy to be ignored in that case :)

Isn't there a case where the main kernel "image" package is empty so you just have to break the dependency at the main image level rather than messing with the modules? or am I half remembering something badly?

I've always just used this (from kernel.bbclass):

# 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})"

Maybe that's the one you are remembering ?

Bruce

Quoted 5 lines

Cheers,

Richard

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
#7 lore raw

Re: [OE-core] [PATCH 2/2] kernel-module-split: modules should recommend the kernel image

Quoted 8 lines · Bruce Ashfield

I've always just used this (from kernel.bbclass):

# 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})"

Maybe that's the one you are remembering ?

Obviously this won't work in the situations where you want a normal image with a kernel but also a initramfs with a kernel module in it, as that behaviour isn't machine specific but image specific.

If this was a recommends then it could be removed via PACKAGE_EXCLUDE, but we'd need to be sure that nothing from the kernel ended up getting pulled in via a single module.

Ross

#8 lore raw

Re: [OE-core] [PATCH 2/2] kernel-module-split: modules should recommend the kernel image

Quoted 10 lines · Ross Burton
Quoted 8 lines · Bruce Ashfield

I've always just used this (from kernel.bbclass):

# 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})"

Maybe that's the one you are remembering ?

Quoted 7 lines

Obviously this won't work in the situations where you want a normal image with a kernel but also a initramfs with a kernel module in it, as that behaviour isn't machine specific but image specific.

If this was a recommends then it could be removed via PACKAGE_EXCLUDE, but we'd need to be sure that nothing from the kernel ended up getting pulled in via a single module.

I think making this a RRECOMMENDS and doing that may enable more workflows and make things easier all around. Can you check and see if it does pull other unwanted stuff in? I'm hoping it doesn't.

Cheers,

Richard

#9 lore raw

Re: [OE-core] [PATCH 2/2] kernel-module-split: modules should recommend the kernel image

Quoted 11 lines · Richard Purdie
Quoted 7 lines

Obviously this won't work in the situations where you want a normal image with a kernel but also a initramfs with a kernel module in it, as that behaviour isn't machine specific but image specific.

If this was a recommends then it could be removed via PACKAGE_EXCLUDE, but we'd need to be sure that nothing from the kernel ended up getting pulled in via a single module.

I think making this a RRECOMMENDS and doing that may enable more workflows and make things easier all around. Can you check and see if it does pull other unwanted stuff in? I'm hoping it doesn't.

Tested. Our initramfs pulls in a kernel module, and PACKAGE_EXCLUDE=kernel-image-* stops the image itself being pulled in. It does pull in the kernel-5.15-yocto-standard package, but that just contains a few module config files.

Patch incoming!

Ross