Skip to contentSkip to conversation

glibc: inherit update-rc.d

PATCH In review Ross Burton 3 participants 4 messages Oct 13, 2025 – Oct 14, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 glibc: inherit update-rc.d

The nscd package has an init script, so we should be inheriting the update-rc.d class like we inherit the the systemd class.

---
 meta/recipes-core/glibc/glibc-package.inc | 3 +++
 meta/recipes-core/glibc/glibc.inc         | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
meta/recipes-core/glibc/glibc-package.inc +3 -0
index 21f2200d19b..d4941a21a10 100644
@@ -297,3 +297,6 @@ CONFFILES:nscd = "${sysconfdir}/nscd.conf"
 
 SYSTEMD_PACKAGES = "nscd"
 SYSTEMD_SERVICE:nscd = "nscd.service"
+
+INITSCRIPT_PACKAGES = "nscd"
+INITSCRIPT_NAME = "nscd"
meta/recipes-core/glibc/glibc.inc +1 -1
index d8f20c87dd6..0aa36318193 100644
@@ -5,7 +5,7 @@ DEPENDS = "virtual/cross-cc virtual/cross-binutils libgcc-initial linux-libc-hea
 
 PROVIDES = "virtual/libc"
 PROVIDES += "virtual/libintl virtual/libiconv"
-inherit autotools texinfo systemd
+inherit autotools texinfo systemd update-rc.d
 
 LEAD_SONAME = "libc.so"
 
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/2 glibc: only install nscd if it's been enabled

Whilst the actual nscd binary won't be installed if the PACKAGECONFIG is disabled, we were still installing the init scripts and configuration files. These should be wrapped with PACKAGECONFIG checks.

${localstatedir}/db and makedbs.sh are part of libnss-db not nscd, so ensure they're still always installed.

---
 meta/recipes-core/glibc/glibc-package.inc | 41 +++++++++++++----------
 1 file changed, 23 insertions(+), 18 deletions(-)
meta/recipes-core/glibc/glibc-package.inc +23 -18
index d4941a21a10..3d721d8f69f 100644
@@ -98,16 +98,20 @@ do_install() {
 		rm -f ${D}${infodir}/dir
 	fi
 
-	install -d ${D}${sysconfdir}/init.d
-	install -d ${D}${localstatedir}/db/nscd
-	install -m 0755 ${S}/nscd/nscd.init ${D}${sysconfdir}/init.d/nscd
-	install -m 0755 ${S}/nscd/nscd.conf ${D}${sysconfdir}/nscd.conf
+	install -d ${D}${localstatedir}/db
 	install -m 0755 ${UNPACKDIR}/makedbs.sh ${D}${localstatedir}/db
-	sed -i "s%daemon%start-stop-daemon --start --exec%g" ${D}${sysconfdir}/init.d/nscd
-	sed -i "s|\(enable-cache\t\+netgroup\t\+\)yes|\1no|" ${D}${sysconfdir}/nscd.conf
 
-	install -d ${D}${systemd_system_unitdir}
-	install -m 0644 ${S}/nscd/nscd.service ${D}${systemd_system_unitdir}/
+	if ${@bb.utils.contains('PACKAGECONFIG', 'nscd', 'true', 'false', d)}; then
+		install -d ${D}${sysconfdir}/init.d
+		install -d ${D}${localstatedir}/db/nscd
+		install -m 0755 ${S}/nscd/nscd.init ${D}${sysconfdir}/init.d/nscd
+		install -m 0755 ${S}/nscd/nscd.conf ${D}${sysconfdir}/nscd.conf
+		sed -i "s%daemon%start-stop-daemon --start --exec%g" ${D}${sysconfdir}/init.d/nscd
+		sed -i "s|\(enable-cache\t\+netgroup\t\+\)yes|\1no|" ${D}${sysconfdir}/nscd.conf
+
+		install -d ${D}${systemd_system_unitdir}
+		install -m 0644 ${S}/nscd/nscd.service ${D}${systemd_system_unitdir}/
+	fi
 
 	# The dynamic loader will have been installed into
 	# ${base_libdir}. However, if that isn't going to end up being
@@ -132,18 +136,19 @@ def get_libc_fpu_setting(bb, d):
     return ""
 
 do_install:append:class-target() {
-	if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
-		install -d ${D}${nonarch_libdir}/tmpfiles.d
-		echo "d /run/nscd 755 root root -" \
-			> ${D}${nonarch_libdir}/tmpfiles.d/nscd.conf
-	fi
+	if ${@bb.utils.contains('PACKAGECONFIG', 'nscd', 'true', 'false', d)}; then
+		if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+			install -d ${D}${nonarch_libdir}/tmpfiles.d
+			echo "d /run/nscd 755 root root -" \
+				> ${D}${nonarch_libdir}/tmpfiles.d/nscd.conf
+		fi
 
-	if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
-		install -d ${D}${sysconfdir}/default/volatiles
-		echo "d root root 0755 /var/run/nscd none" \
-			> ${D}${sysconfdir}/default/volatiles/98_nscd
+		if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
+			install -d ${D}${sysconfdir}/default/volatiles
+			echo "d root root 0755 /var/run/nscd none" \
+				> ${D}${sysconfdir}/default/volatiles/98_nscd
+		fi
 	fi
-
 }
 do_install:append:aarch64 () {
 	do_install_armmultilib
Signature · 1 line
2.43.0
#2 lore raw

Re: [OE-core] [PATCH 2/2] glibc: only install nscd if it's been enabled

Quoted 23 lines · Ross Burton via lists.openembedded.org

Whilst the actual nscd binary won't be installed if the PACKAGECONFIG is disabled, we were still installing the init scripts and configuration files. These should be wrapped with PACKAGECONFIG checks.

${localstatedir}/db and makedbs.sh are part of libnss-db not nscd, so ensure they're still always installed.

---
 meta/recipes-core/glibc/glibc-package.inc | 41 +++++++++++++----------
 1 file changed, 23 insertions(+), 18 deletions(-)
meta/recipes-core/glibc/glibc-package.inc +0 -2
index d4941a21a10..3d721d8f69f 100644
@@ -98,16 +98,20 @@ do_install() {
                rm -f ${D}${infodir}/dir
        fi
 
-       install -d ${D}${sysconfdir}/init.d
-       install -d ${D}${localstatedir}/db/nscd

meta/recipes-core/glibc/glibc-package.inc do_install() { · line 104

Quoted 10 lines
meta/recipes-core/glibc/glibc-package.inc +2 -6
-       install -m 0755 ${S}/nscd/nscd.init ${D}${sysconfdir}/init.d/nscd
-       install -m 0755 ${S}/nscd/nscd.conf ${D}${sysconfdir}/nscd.conf
+       install -d ${D}${localstatedir}/db
        install -m 0755 ${UNPACKDIR}/makedbs.sh ${D}${localstatedir}/db
-       sed -i "s%daemon%start-stop-daemon --start --exec%g" ${D}${sysconfdir}/init.d/nscd
-       sed -i "s|\(enable-cache\t\+netgroup\t\+\)yes|\1no|" ${D}${sysconfdir}/nscd.conf
 
-       install -d ${D}${systemd_system_unitdir}
-       install -m 0644 ${S}/nscd/nscd.service ${D}${systemd_system_unitdir}/
+       if ${@bb.utils.contains('PACKAGECONFIG', 'nscd', 'true', 'false', d)}; then

should it check for initsystem type as well before doing the following operations I wonder

Quoted 55 lines
meta/recipes-core/glibc/glibc-package.inc +21 -11
+               install -d ${D}${sysconfdir}/init.d
+               install -d ${D}${localstatedir}/db/nscd
+               install -m 0755 ${S}/nscd/nscd.init ${D}${sysconfdir}/init.d/nscd
+               install -m 0755 ${S}/nscd/nscd.conf ${D}${sysconfdir}/nscd.conf
+               sed -i "s%daemon%start-stop-daemon --start --exec%g" ${D}${sysconfdir}/init.d/nscd
+               sed -i "s|\(enable-cache\t\+netgroup\t\+\)yes|\1no|" ${D}${sysconfdir}/nscd.conf
+
+               install -d ${D}${systemd_system_unitdir}
+               install -m 0644 ${S}/nscd/nscd.service ${D}${systemd_system_unitdir}/
+       fi
 
        # The dynamic loader will have been installed into
        # ${base_libdir}. However, if that isn't going to end up being
@@ -132,18 +136,19 @@ def get_libc_fpu_setting(bb, d):
     return ""
 
 do_install:append:class-target() {
-       if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
-               install -d ${D}${nonarch_libdir}/tmpfiles.d
-               echo "d /run/nscd 755 root root -" \
-                       > ${D}${nonarch_libdir}/tmpfiles.d/nscd.conf
-       fi
+       if ${@bb.utils.contains('PACKAGECONFIG', 'nscd', 'true', 'false', d)}; then
+               if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+                       install -d ${D}${nonarch_libdir}/tmpfiles.d
+                       echo "d /run/nscd 755 root root -" \
+                               > ${D}${nonarch_libdir}/tmpfiles.d/nscd.conf
+               fi
 
-       if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
-               install -d ${D}${sysconfdir}/default/volatiles
-               echo "d root root 0755 /var/run/nscd none" \
-                       > ${D}${sysconfdir}/default/volatiles/98_nscd
+               if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
+                       install -d ${D}${sysconfdir}/default/volatiles
+                       echo "d root root 0755 /var/run/nscd none" \
+                               > ${D}${sysconfdir}/default/volatiles/98_nscd
+               fi
        fi
-
 }
 do_install:append:aarch64 () {
        do_install_armmultilib
--

2.43.0

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

#3 lore raw
In reply to Ross Burton
Quoted 5 lines · Ross Burton via lists.openembedded.org

The nscd package has an init script, so we should be inheriting the update-rc.d class like we inherit the the systemd class.

---

Hi Ross,

I'm afraid, but this is creating circular dependencies.

Identifying dependency loops (this may take a short while)...

ERROR:
Dependency loop #1 found:
Task /srv/pokybuild/yocto-worker/oe-selftest-fedora/build/meta/recipes-core/glibc/glibc_2.42.bb:do_collect_spdx_deps (dependent Tasks ['patch_2.8.bb:do_populate_sysroot', 'libtool-native_2.5.4.bb:do_create_spdx', 'bison_3.8.2.bb:do_create_spdx', 'initscripts_1.0.bb:do_create_spdx', 'automake_1.18.1.bb:do_create_spdx', 'linux-libc-headers_6.16.bb:do_create_spdx', 'gcc-cross_15.2.bb:do_create_spdx', 'gperf_3.3.bb:do_create_spdx', 'binutils-cross_2.45.bb:do_create_spdx', 'glibc_2.42.bb:do_unpack', 'libgcc-initial_15.2.bb:do_create_spdx', 'update-rc.d_0.8.bb:do_create_spdx', 'texinfo-dummy-native.bb:do_create_spdx', 'quilt-native_0.69.bb:do_populate_sysroot', 'autoconf_2.72.bb:do_create_spdx']) Task /srv/pokybuild/yocto-worker/oe-selftest-fedora/build/meta/recipes-core/glibc/glibc_2.42.bb:do_create_spdx (dependent Tasks ['patch_2.8.bb:do_populate_sysroot', 'glibc_2.42.bb:do_populate_sysroot', 'glibc_2.42.bb:do_collect_spdx_deps', 'glibc_2.42.bb:do_deploy_source_date_epoch', 'quilt-native_0.69.bb:do_populate_sysroot', 'glibc_2.42.bb:do_package', 'glibc_2.42.bb:do_packagedata'])
Task /srv/pokybuild/yocto-worker/oe-selftest-fedora/build/meta/recipes-core/update-rc.d/update-rc.d_0.8.bb:do_collect_spdx_deps (dependent Tasks ['patch_2.8.bb:do_populate_sysroot', 'update-rc.d_0.8.bb:do_unpack', 'gcc-cross_15.2.bb:do_create_spdx', 'glibc_2.42.bb:do_create_spdx', 'gcc-runtime_15.2.bb:do_create_spdx', 'quilt-native_0.69.bb:do_populate_sysroot'])
Task /srv/pokybuild/yocto-worker/oe-selftest-fedora/build/meta/recipes-core/update-rc.d/update-rc.d_0.8.bb:do_create_spdx (dependent Tasks ['patch_2.8.bb:do_populate_sysroot', 'update-rc.d_0.8.bb:do_package', 'update-rc.d_0.8.bb:do_deploy_source_date_epoch', 'update-rc.d_0.8.bb:do_populate_sysroot', 'update-rc.d_0.8.bb:do_packagedata', 'update-rc.d_0.8.bb:do_collect_spdx_deps', 'quilt-native_0.69.bb:do_populate_sysroot'])

https://autobuilder.yoctoproject.org/valkyrie/#/builders/35/builds/2532
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/2446
https://autobuilder.yoctoproject.org/valkyrie/#/builders/59/builds/2574

Thanks,
Mathieu

Signature · 3 lines
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com