* [PATCH 0/4] More useradd cleanups
@ 2011-11-09 2:56 Scott Garman
2011-11-09 2:56 ` [PATCH 1/4] useradd.bbclass: only modify packages in USERADD_PACKAGES Scott Garman
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Scott Garman @ 2011-11-09 2:56 UTC (permalink / raw)
To: openembedded-core
Hello,
Richard pointed out that USERADDPN is no longer needed in
useradd.bbclass. While removing that, I noticed that I was actually
injecting the user/group preinst script into *all* packages whose
recipe inherits useradd. That's not what we want, and is the reason
for the USERADD_PACKAGES variable. So I refactored the class to fix
that and clarified the useradd-example recipe documentation.
Finally, I added another check to avoid modifying -nativesdk packages.
The following changes since commit 25fae81538a92e15eab3fc169ebce44505f67839:
python: skip setup.py 'import check' when cross-compiling (2011-11-08 21:44:23 +0000)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib sgarman/useradd-cleanup-final
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=sgarman/useradd-cleanup-final
Scott Garman (4):
useradd.bbclass: only modify packages in USERADD_PACKAGES
useradd.bbclass: do not modify -nativesdk packages
useradd-example.bb: update example documentation comments
avahi: remove USERADDPN
.../recipes-skeleton/useradd/useradd-example.bb | 9 ++--
meta/classes/useradd.bbclass | 45 ++++++++------------
meta/recipes-connectivity/avahi/avahi.inc | 1 -
3 files changed, 22 insertions(+), 33 deletions(-)
--
1.7.5.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] useradd.bbclass: only modify packages in USERADD_PACKAGES
2011-11-09 2:56 [PATCH 0/4] More useradd cleanups Scott Garman
@ 2011-11-09 2:56 ` Scott Garman
2011-11-09 2:56 ` [PATCH 2/4] useradd.bbclass: do not modify -nativesdk packages Scott Garman
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Scott Garman @ 2011-11-09 2:56 UTC (permalink / raw)
To: openembedded-core
Previously we injected the user/group preinstall script into all
output packages. This fixes that so that only packages listed in
USERADD_PACKAGES get modified.
It also removes the USERADDPN variable, which is no longer needed.
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
meta/classes/useradd.bbclass | 42 ++++++++++++++++--------------------------
1 files changed, 16 insertions(+), 26 deletions(-)
diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass
index a8a1c14..3b2d1db 100644
--- a/meta/classes/useradd.bbclass
+++ b/meta/classes/useradd.bbclass
@@ -1,5 +1,3 @@
-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
@@ -106,30 +104,29 @@ SYSROOTPOSTFUNC_virtclass-nativesdk = ""
# Recipe parse-time sanity checks
def update_useradd_after_parse(d):
- if not d.getVar('USERADD_PACKAGES', False):
- if not d.getVar('USERADD_PARAM', False) and not d.getVar('GROUPADD_PARAM', False):
- raise bb.build.FuncFailed, "%s inherits useradd but doesn't set USERADD_PARAM or GROUPADD_PARAM" % bb.data.getVar('FILE', d)
+ useradd_packages = d.getVar('USERADD_PACKAGES', True)
+
+ if not useradd_packages:
+ raise bb.build.FuncFailed, "%s inherits useradd but doesn't set USERADD_PACKAGES" % bb.data.getVar('FILE', d)
+
+ for pkg in useradd_packages.split():
+ if not d.getVar('USERADD_PARAM_%s' % pkg, True) and not d.getVar('GROUPADD_PARAM_%s' % pkg, True):
+ raise bb.build.FuncFailed, "%s inherits useradd but doesn't set USERADD_PARAM or GROUPADD_PARAM for package %s" % (bb.data.getVar('FILE', d), pkg)
python __anonymous() {
update_useradd_after_parse(d)
}
# Return a single [GROUP|USER]ADD_PARAM formatted string which includes the
-# [group|user]add parameters for all packages in this recipe
+# [group|user]add parameters for all USERADD_PACKAGES in this recipe
def get_all_cmd_params(d, cmd_type):
import string
param_type = cmd_type.upper() + "ADD_PARAM_%s"
params = []
- pkgs = d.getVar('USERADD_PACKAGES', True)
- if not pkgs:
- pkgs = d.getVar('USERADDPN', True)
- packages = (d.getVar('PACKAGES', True) or "").split()
- if packages and pkgs not in packages:
- pkgs = packages[0]
-
- for pkg in pkgs.split():
+ useradd_packages = d.getVar('USERADD_PACKAGES', True) or ""
+ for pkg in useradd_packages.split():
param = d.getVar(param_type % pkg, True)
if param:
params.append(param)
@@ -156,17 +153,10 @@ fakeroot python populate_packages_prepend () {
rdepends = d.getVar("RDEPENDS_%s" % pkg, True) or ""
rdepends += " base-passwd shadow"
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
- # entries, so this is safe.
- pkgs = d.getVar('USERADD_PACKAGES', True)
- if not pkgs:
- pkgs = d.getVar('USERADDPN', True)
- packages = (d.getVar('PACKAGES', True) or "").split()
- if packages and pkgs not in packages:
- pkgs = packages[0]
- for pkg in pkgs.split():
+
+ # Add the user/group preinstall scripts and RDEPENDS requirements
+ # to packages specified by USERADD_PACKAGES
+ useradd_packages = d.getVar('USERADD_PACKAGES', True) or ""
+ for pkg in useradd_packages.split():
update_useradd_package(pkg)
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] useradd.bbclass: do not modify -nativesdk packages
2011-11-09 2:56 [PATCH 0/4] More useradd cleanups Scott Garman
2011-11-09 2:56 ` [PATCH 1/4] useradd.bbclass: only modify packages in USERADD_PACKAGES Scott Garman
@ 2011-11-09 2:56 ` Scott Garman
2011-11-09 2:56 ` [PATCH 3/4] useradd-example.bb: update example documentation comments Scott Garman
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Scott Garman @ 2011-11-09 2:56 UTC (permalink / raw)
To: openembedded-core
Exclude the addition of user/group code and RDEPENDS changes for
-nativesdk packages.
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
meta/classes/useradd.bbclass | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass
index 3b2d1db..64d6861 100644
--- a/meta/classes/useradd.bbclass
+++ b/meta/classes/useradd.bbclass
@@ -153,10 +153,11 @@ fakeroot python populate_packages_prepend () {
rdepends = d.getVar("RDEPENDS_%s" % pkg, True) or ""
rdepends += " base-passwd shadow"
bb.data.setVar("RDEPENDS_%s" % pkg, rdepends, d)
-
+
# Add the user/group preinstall scripts and RDEPENDS requirements
# to packages specified by USERADD_PACKAGES
- useradd_packages = d.getVar('USERADD_PACKAGES', True) or ""
- for pkg in useradd_packages.split():
- update_useradd_package(pkg)
+ if not bb.data.inherits_class('nativesdk', d):
+ useradd_packages = d.getVar('USERADD_PACKAGES', True) or ""
+ for pkg in useradd_packages.split():
+ update_useradd_package(pkg)
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] useradd-example.bb: update example documentation comments
2011-11-09 2:56 [PATCH 0/4] More useradd cleanups Scott Garman
2011-11-09 2:56 ` [PATCH 1/4] useradd.bbclass: only modify packages in USERADD_PACKAGES Scott Garman
2011-11-09 2:56 ` [PATCH 2/4] useradd.bbclass: do not modify -nativesdk packages Scott Garman
@ 2011-11-09 2:56 ` Scott Garman
2011-11-09 2:56 ` [PATCH 4/4] avahi: remove USERADDPN Scott Garman
2011-11-10 17:18 ` [PATCH 0/4] More useradd cleanups Saul Wold
4 siblings, 0 replies; 6+ messages in thread
From: Scott Garman @ 2011-11-09 2:56 UTC (permalink / raw)
To: openembedded-core
Clarify that only packages listed in USERADD_PACKAGES will
include the user/group creation code.
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
.../recipes-skeleton/useradd/useradd-example.bb | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/meta-skeleton/recipes-skeleton/useradd/useradd-example.bb b/meta-skeleton/recipes-skeleton/useradd/useradd-example.bb
index 02d56f6..b10c1d0 100644
--- a/meta-skeleton/recipes-skeleton/useradd/useradd-example.bb
+++ b/meta-skeleton/recipes-skeleton/useradd/useradd-example.bb
@@ -17,13 +17,12 @@ PACKAGES =+ "${PN}-user3"
inherit useradd
-# Specify which package(s) should include the user/group code.
-# Make sure that any packages which install files owned by custom
-# users/groups are included here. The code which adds users and
-# groups is idempotent.
+# You must set USERADD_PACKAGES when you inherit useradd. This
+# lists which output packages will include the user/group
+# creation code.
USERADD_PACKAGES = "${PN} ${PN}-user3"
-# You *must* set USERADD_PARAM and/or GROUPADD_PARAM when
+# You must also set USERADD_PARAM and/or GROUPADD_PARAM when
# you inherit useradd.
# USERADD_PARAM specifies command line options to pass to the
--
1.7.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] avahi: remove USERADDPN
2011-11-09 2:56 [PATCH 0/4] More useradd cleanups Scott Garman
` (2 preceding siblings ...)
2011-11-09 2:56 ` [PATCH 3/4] useradd-example.bb: update example documentation comments Scott Garman
@ 2011-11-09 2:56 ` Scott Garman
2011-11-10 17:18 ` [PATCH 0/4] More useradd cleanups Saul Wold
4 siblings, 0 replies; 6+ messages in thread
From: Scott Garman @ 2011-11-09 2:56 UTC (permalink / raw)
To: openembedded-core
USERADDPN is no longer used; remove it.
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
meta/recipes-connectivity/avahi/avahi.inc | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/meta/recipes-connectivity/avahi/avahi.inc b/meta/recipes-connectivity/avahi/avahi.inc
index 728c38f..deebbd6 100644
--- a/meta/recipes-connectivity/avahi/avahi.inc
+++ b/meta/recipes-connectivity/avahi/avahi.inc
@@ -23,7 +23,6 @@ SRC_URI = "http://avahi.org/download/avahi-${PV}.tar.gz \
file://99avahi-autoipd \
file://initscript.patch"
-USERADDPN = "avahi-daemon"
USERADD_PACKAGES = "avahi-daemon"
USERADD_PARAM_avahi-daemon = "--system --home /var/run/avahi-daemon \
--no-create-home --shell /bin/false \
--
1.7.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] More useradd cleanups
2011-11-09 2:56 [PATCH 0/4] More useradd cleanups Scott Garman
` (3 preceding siblings ...)
2011-11-09 2:56 ` [PATCH 4/4] avahi: remove USERADDPN Scott Garman
@ 2011-11-10 17:18 ` Saul Wold
4 siblings, 0 replies; 6+ messages in thread
From: Saul Wold @ 2011-11-10 17:18 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer; +Cc: Scott Garman
On 11/08/2011 06:56 PM, Scott Garman wrote:
> Hello,
>
> Richard pointed out that USERADDPN is no longer needed in
> useradd.bbclass. While removing that, I noticed that I was actually
> injecting the user/group preinst script into *all* packages whose
> recipe inherits useradd. That's not what we want, and is the reason
> for the USERADD_PACKAGES variable. So I refactored the class to fix
> that and clarified the useradd-example recipe documentation.
>
> Finally, I added another check to avoid modifying -nativesdk packages.
>
> The following changes since commit 25fae81538a92e15eab3fc169ebce44505f67839:
>
> python: skip setup.py 'import check' when cross-compiling (2011-11-08 21:44:23 +0000)
>
> are available in the git repository at:
> git://git.pokylinux.org/poky-contrib sgarman/useradd-cleanup-final
> http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=sgarman/useradd-cleanup-final
>
> Scott Garman (4):
> useradd.bbclass: only modify packages in USERADD_PACKAGES
> useradd.bbclass: do not modify -nativesdk packages
> useradd-example.bb: update example documentation comments
> avahi: remove USERADDPN
>
> .../recipes-skeleton/useradd/useradd-example.bb | 9 ++--
> meta/classes/useradd.bbclass | 45 ++++++++------------
> meta/recipes-connectivity/avahi/avahi.inc | 1 -
> 3 files changed, 22 insertions(+), 33 deletions(-)
>
Merged int OE-Core
Thanks
Sau!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-11-10 17:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-09 2:56 [PATCH 0/4] More useradd cleanups Scott Garman
2011-11-09 2:56 ` [PATCH 1/4] useradd.bbclass: only modify packages in USERADD_PACKAGES Scott Garman
2011-11-09 2:56 ` [PATCH 2/4] useradd.bbclass: do not modify -nativesdk packages Scott Garman
2011-11-09 2:56 ` [PATCH 3/4] useradd-example.bb: update example documentation comments Scott Garman
2011-11-09 2:56 ` [PATCH 4/4] avahi: remove USERADDPN Scott Garman
2011-11-10 17:18 ` [PATCH 0/4] More useradd cleanups Saul Wold
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.