Patchwork [1/1] useradd.bbclass: fix how RDEPENDS is setup

login
register
mail settings
Submitter Scott Garman
Date Nov. 6, 2011, 7:31 p.m.
Message ID <505c8c4924bc7fcbea892c32b7144ee3b1b4c81b.1320607825.git.scott.a.garman@intel.com>
Download mbox | patch
Permalink /patch/14379/
State New
Headers show

Comments

Scott Garman - Nov. 6, 2011, 7:31 p.m.
Fix bug where only packages named PN included base-passwd in
RDEPENDS. Also remove shadow requirement, since some targets
do not use shadow and file ownership can be changed with only
passwd/group entries.

This fixes [YOCTO #1727]

Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
 meta/classes/useradd.bbclass |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
Phil Blundell - Nov. 6, 2011, 8:25 p.m.
On Sun, 2011-11-06 at 11:31 -0800, Scott Garman wrote:
> Fix bug where only packages named PN included base-passwd in
> RDEPENDS. Also remove shadow requirement, since some targets
> do not use shadow and file ownership can be changed with only
> passwd/group entries.
> 
> This fixes [YOCTO #1727]

Don't you need shadow or some equivalent to provide /sbin/useradd so
that the postinsts work for on-target installs?  Removing shadow from
RDEPENDS does sound like a good plan for the no-package-management case,
but I'm not sure it's safe otherwise.

p.
Scott Garman - Nov. 6, 2011, 11:07 p.m.
On 11/06/2011 12:25 PM, Phil Blundell wrote:
> On Sun, 2011-11-06 at 11:31 -0800, Scott Garman wrote:
>> Fix bug where only packages named PN included base-passwd in
>> RDEPENDS. Also remove shadow requirement, since some targets
>> do not use shadow and file ownership can be changed with only
>> passwd/group entries.
>>
>> This fixes [YOCTO #1727]
>
> Don't you need shadow or some equivalent to provide /sbin/useradd so
> that the postinsts work for on-target installs?  Removing shadow from
> RDEPENDS does sound like a good plan for the no-package-management case,
> but I'm not sure it's safe otherwise.

Of course you're right. Thank you for pointing this out. I will spin a 
v2 of the patchset.

Scott

Patch

diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass
index fb70b3e..12d7586 100644
--- a/meta/classes/useradd.bbclass
+++ b/meta/classes/useradd.bbclass
@@ -4,7 +4,6 @@  USERADDPN ?= "${PN}"
 # target sysroot, and shadow -native and -sysroot provide the utilities
 # and support files needed to add and modify user and group accounts
 DEPENDS_append = " base-passwd shadow-native shadow-sysroot"
-RDEPENDS_${USERADDPN}_append = " base-passwd shadow"
 
 # This preinstall function will be run in two contexts: once for the
 # native sysroot (as invoked by the useradd_sysroot() wrapper), and
@@ -147,6 +146,13 @@  fakeroot python populate_packages_prepend () {
 		preinst += d.getVar('useradd_preinst', True)
 		bb.data.setVar('pkg_preinst_%s' % pkg, preinst, d)
 
+		# RDEPENDS setup
+		rdepends = d.getVar("RDEPENDS_%s" % pkg, True)
+		if not rdepends:
+			rdepends = ""
+		rdepends += " base-passwd"
+		bb.data.setVar("RDEPENDS_%s" % pkg, rdepends, d)
+		
 	# We add the user/group calls to all packages to allow any package
 	# to contain files owned by the users/groups defined in the recipe.
 	# The user/group addition code is careful not to create duplicate