diff mbox series

[2/2] meta-selftest: add usegroup-deponly recipe to test USERADD_DEPENDS only

Message ID 20260408150003.18063-3-zizuzacker@gmail.com
State New
Headers show
Series useradd.bbclass: fix parse error when only USERADD_DEPENDS is set | expand

Commit Message

Zk47T April 8, 2026, 3 p.m. UTC
Add a test recipe that inherits useradd and only sets USERADD_DEPENDS
without USERADD_PACKAGES to validate the fix for [YOCTO #15863].

The root bug is that useradd.bbclass unconditionally requires
USERADD_PACKAGES to be set, even when a recipe only needs to depend on
users/groups created by another recipe via USERADD_DEPENDS. This recipe
depends on creategroup1 for user gt1 and group grouptest, but does not
create any users/groups itself, exercising the code path fixed in the
previous commit.

Signed-off-by: Zk47T <zizuzacker@gmail.com>
---
 .../selftest-users/usegroup-deponly.bb        | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 meta-selftest/recipes-test/selftest-users/usegroup-deponly.bb
diff mbox series

Patch

diff --git a/meta-selftest/recipes-test/selftest-users/usegroup-deponly.bb b/meta-selftest/recipes-test/selftest-users/usegroup-deponly.bb
new file mode 100644
index 0000000000..e5db7a47ea
--- /dev/null
+++ b/meta-selftest/recipes-test/selftest-users/usegroup-deponly.bb
@@ -0,0 +1,25 @@ 
+SUMMARY = "Test recipe that only uses USERADD_DEPENDS without USERADD_PARAM"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+LICENSE = "MIT"
+
+# This recipe depends on the user/group created by creategroup1
+# but does NOT create users or groups itself.
+USERADD_DEPENDS = "creategroup1"
+
+S = "${WORKDIR}/sources"
+UNPACKDIR = "${S}"
+
+EXCLUDE_FROM_WORLD = "1"
+
+inherit useradd allarch
+
+TESTDIR = "${D}${sysconfdir}/deponly"
+
+do_install() {
+	install -d   ${TESTDIR}
+	touch        ${TESTDIR}/file
+	chown gt1:grouptest ${TESTDIR}/file
+}
+
+FILES:${PN} = "${sysconfdir}/deponly/*"