[OE-core] [PATCH 1/2] useradd.bbclass: handle nativesdk case

Eric Bénard eric at eukrea.com
Mon Nov 7 21:11:54 UTC 2011


* without this patch, building dbus-nativesdk leads to a missing
dependency on 'base-passwd-nativesdk'
This was added by commit 46e6c3fa8034b12d178d605f3f5d7efe69671a13
* this patch handle the nativesdk case in the class useradd
* close bug 1702 http://bugzilla.pokylinux.org/show_bug.cgi?id=1702

Signed-off-by: Eric Bénard <eric at eukrea.com>
---
 meta/classes/useradd.bbclass |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass
index fb70b3e..b935d01 100644
--- a/meta/classes/useradd.bbclass
+++ b/meta/classes/useradd.bbclass
@@ -3,9 +3,16 @@ USERADDPN ?= "${PN}"
 # base-passwd-cross provides the default passwd and group files in the
 # 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"
 
+def useradd_dep_append(d):
+	deps = ' '
+	if not bb.data.inherits_class('nativesdk', d):
+		deps = ' shadow-native shadow-sysroot base-passwd'
+	return deps
+
+DEPENDS_append = "${@useradd_dep_append(d)}"
+
 # This preinstall function will be run in two contexts: once for the
 # native sysroot (as invoked by the useradd_sysroot() wrapper), and
 # also as the preinst script in the target package.
@@ -96,8 +103,13 @@ useradd_sysroot_sstate () {
 	fi
 }
 
-do_install[prefuncs] += "useradd_sysroot"
-SSTATEPOSTINSTFUNCS += "useradd_sysroot_sstate"
+python () {
+	if not bb.data.inherits_class('nativesdk', d):
+		funcs = bb.data.getVarFlag('do_install', 'prefuncs', d) or ""
+		funcs += 'useradd_sysroot'
+		bb.data.setVarFlag('do_install', 'prefuncs', funcs, d)
+		d.setVar('SSTATEPOSTINSTFUNCS', (bb.data.getVar('SSTATEPOSTINSTFUNCS', d, True) or "").join("useradd_sysroot_sstate"))
+}
 
 # Recipe parse-time sanity checks
 def update_useradd_after_parse(d):
-- 
1.7.6.4





More information about the Openembedded-core mailing list