]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
useradd.bbclass: allow inheriting with only USERADD_DEPENDS set
authorZk47T <zizuzacker@gmail.com>
Wed, 8 Apr 2026 15:00:02 +0000 (22:00 +0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 13 Apr 2026 17:00:17 +0000 (18:00 +0100)
When a recipe inherits useradd and only sets USERADD_DEPENDS (to depend
on users/groups created by another recipe), without creating any
users/groups itself, the parse-time sanity check incorrectly throws a
fatal error about missing USERADD_PACKAGES.

Skip the USERADD_PACKAGES/USERADD_PARAM validation when USERADD_DEPENDS
is set but USERADD_PACKAGES is not, since the recipe only needs build
dependency tracking, not user/group creation.

Fixes [YOCTO #15863]

Signed-off-by: Zk47T <zizuzacker@gmail.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/useradd.bbclass

index 16a65ac3236e6492c3c54e13520fd2d8bbb900a6..9d857a4555da79e24a7ce1473ee37447c38dfc74 100644 (file)
@@ -212,6 +212,11 @@ def update_useradd_after_parse(d):
     useradd_packages = d.getVar('USERADD_PACKAGES')
 
     if not useradd_packages:
+        # It's valid to inherit useradd and only set USERADD_DEPENDS to
+        # depend on users/groups created by another recipe, without
+        # creating any users/groups in this recipe.
+        if d.getVar('USERADD_DEPENDS'):
+            return
         bb.fatal("%s inherits useradd but doesn't set USERADD_PACKAGES" % d.getVar('FILE', False))
 
     for pkg in useradd_packages.split():