diff mbox series

[RFC,1/4] initramfs-framework: make RDEPENDS/RRECOMMENDS base package-specific

Message ID 20250415130608.1804620-1-bst@pengutronix.de
State New
Headers show
Series [RFC,1/4] initramfs-framework: make RDEPENDS/RRECOMMENDS base package-specific | expand

Commit Message

Bastian Krause April 15, 2025, 1:06 p.m. UTC
initramfs-framework itself is a meta package. It cannot be referenced in
PACKAGE_INSTALL directly, so the RDEPENDS/RRECOMMENDS do not have an
effect. So turn them into directives for initramfs-framework-base
instead.

Currently all users of initramfs-framework-* add
${VIRTUAL-RUNTIME_base-utils} explicitly to PACKAGE_INSTALL. For
`PACKAGE_CLASSES = "package_rpm"`, a dependency for `/bin/sh` is added by
RPM's shebang detection further hiding this issue.

Signed-off-by: Bastian Krause <bst@pengutronix.de>
---
 meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Bastian Krause April 15, 2025, 1:11 p.m. UTC | #1
On 4/15/25 3:06 PM, Bastian Krause wrote:
> initramfs-framework itself is a meta package. It cannot be referenced in
> PACKAGE_INSTALL directly, so the RDEPENDS/RRECOMMENDS do not have an
> effect. So turn them into directives for initramfs-framework-base
> instead.
> 
> Currently all users of initramfs-framework-* add
> ${VIRTUAL-RUNTIME_base-utils} explicitly to PACKAGE_INSTALL. For
> `PACKAGE_CLASSES = "package_rpm"`, a dependency for `/bin/sh` is added by
> RPM's shebang detection further hiding this issue.

Initially I stumbled upon this in a custom initramfs image with:

   PACAKGE_INSTALL = "initramfs-framework-base"

Having PACKAGE_CLASSES = "package_ipk", the initramfs did not contain a
shell. With PACKAGE_CLASSES = "package_rpm" however, busybox appeared
(unexpectedly) in the image.

Checking the rpm package's dependencies:

   $ rpm -qp build/tmp/deploy/rpm/noarch/initramfs-framework-base-1.0-r0.noarch.rpm --requires
   warning: Found bdb_ro Packages database while attempting sqlite backend: using bdb_ro backend.
   /bin/sh
   rpmlib(CompressedFileNames) <= 3.0.4-1
   rpmlib(FileDigests) <= 4.6.0-1
   rpmlib(PayloadFilesHavePrefix) <= 4.0-1
   rpmlib(PayloadIsZstd) <= 5.4.18-1

The shebang in the initramfs-framework-base scripts is added as a
dependency, pulling in busybox in my case.

Now I'm wondering if that's expected. I'm surprised that switching the
package manager results in additional dependencies getting pulled in.

This seems to have caused issues before, e.g.:

   https://git.yoctoproject.org/poky/commit/?id=bc5d66e793b0750e540e9dac4608b8eb9644590e

Regards,
Bastian


> 
> Signed-off-by: Bastian Krause <bst@pengutronix.de>
> ---
>   meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
> index bb4984366d..184da4f39d 100644
> --- a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
> +++ b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
> @@ -1,8 +1,6 @@
>   SUMMARY = "Modular initramfs system"
>   LICENSE = "MIT"
>   LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
> -RDEPENDS:${PN} += "${VIRTUAL-RUNTIME_base-utils}"
> -RRECOMMENDS:${PN} = "${VIRTUAL-RUNTIME_base-utils-syslog}"
>   
>   
>   inherit allarch
> @@ -72,6 +70,7 @@ PACKAGES = "${PN}-base \
>              "
>   
>   FILES:${PN}-base = "/init /init.d/99-finish /dev"
> +RDEPENDS:${PN}-base += "${VIRTUAL-RUNTIME_base-utils}"
>   
>   # 99-finish in base depends on some other module which mounts
>   # the rootfs, like 90-rootfs. To replace that default, use
> @@ -79,7 +78,7 @@ FILES:${PN}-base = "/init /init.d/99-finish /dev"
>   # initramfs recipe and install something else, or install
>   # something that runs earlier (for example, a 89-my-rootfs)
>   # and mounts the rootfs. Then 90-rootfs will proceed immediately.
> -RRECOMMENDS:${PN}-base += "initramfs-module-rootfs"
> +RRECOMMENDS:${PN}-base += "initramfs-module-rootfs ${VIRTUAL-RUNTIME_base-utils-syslog}"
>   
>   SUMMARY:initramfs-module-exec = "initramfs support for easy execution of applications"
>   RDEPENDS:initramfs-module-exec = "${PN}-base"
diff mbox series

Patch

diff --git a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
index bb4984366d..184da4f39d 100644
--- a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
@@ -1,8 +1,6 @@ 
 SUMMARY = "Modular initramfs system"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
-RDEPENDS:${PN} += "${VIRTUAL-RUNTIME_base-utils}"
-RRECOMMENDS:${PN} = "${VIRTUAL-RUNTIME_base-utils-syslog}"
 
 
 inherit allarch
@@ -72,6 +70,7 @@  PACKAGES = "${PN}-base \
            "
 
 FILES:${PN}-base = "/init /init.d/99-finish /dev"
+RDEPENDS:${PN}-base += "${VIRTUAL-RUNTIME_base-utils}"
 
 # 99-finish in base depends on some other module which mounts
 # the rootfs, like 90-rootfs. To replace that default, use
@@ -79,7 +78,7 @@  FILES:${PN}-base = "/init /init.d/99-finish /dev"
 # initramfs recipe and install something else, or install
 # something that runs earlier (for example, a 89-my-rootfs)
 # and mounts the rootfs. Then 90-rootfs will proceed immediately.
-RRECOMMENDS:${PN}-base += "initramfs-module-rootfs"
+RRECOMMENDS:${PN}-base += "initramfs-module-rootfs ${VIRTUAL-RUNTIME_base-utils-syslog}"
 
 SUMMARY:initramfs-module-exec = "initramfs support for easy execution of applications"
 RDEPENDS:initramfs-module-exec = "${PN}-base"