* [RFC 0/2] useradd improvements
@ 2023-11-23 13:48 Eilís 'pidge' Ní Fhlannagáin
2023-11-23 13:49 ` [RFC 1/2] usergrouptests: Add initial useradd testing Eilís 'pidge' Ní Fhlannagáin
2023-11-23 13:49 ` [RFC 2/2] useradd.bbclass: ensure sysroot_setscene for DEPENDS Eilís 'pidge' Ní Fhlannagáin
0 siblings, 2 replies; 8+ messages in thread
From: Eilís 'pidge' Ní Fhlannagáin @ 2023-11-23 13:48 UTC (permalink / raw)
To: openembedded-core
This patch series includes tests for a few deficits in useradd and a patch to
user add that should fix a few issues with recipes who have useradd
interdependencies. It's still a WIP, but after discussion with RP I wanted
to send this out.
Eilís 'pidge' Ní Fhlannagáin (2):
usergrouptests: Add initial useradd testing
useradd.bbclass: ensure sysroot_setscene for DEPENDS
.../selftest-users/creategroup1.bb | 32 +++++++++++++++++++
.../selftest-users/creategroup2.bb | 32 +++++++++++++++++++
.../selftest-users/useraddbadtask.bb | 20 ++++++++++++
meta/classes/useradd.bbclass | 8 +++++
.../lib/oeqa/selftest/cases/usergrouptests.py | 32 +++++++++++++++++++
5 files changed, 124 insertions(+)
create mode 100644 meta-selftest/recipes-test/selftest-users/creategroup1.bb
create mode 100644 meta-selftest/recipes-test/selftest-users/creategroup2.bb
create mode 100644 meta-selftest/recipes-test/selftest-users/useraddbadtask.bb
create mode 100644 meta/lib/oeqa/selftest/cases/usergrouptests.py
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [RFC 1/2] usergrouptests: Add initial useradd testing
2023-11-23 13:48 [RFC 0/2] useradd improvements Eilís 'pidge' Ní Fhlannagáin
@ 2023-11-23 13:49 ` Eilís 'pidge' Ní Fhlannagáin
2023-11-27 14:40 ` [OE-core] " Richard Purdie
2023-11-23 13:49 ` [RFC 2/2] useradd.bbclass: ensure sysroot_setscene for DEPENDS Eilís 'pidge' Ní Fhlannagáin
1 sibling, 1 reply; 8+ messages in thread
From: Eilís 'pidge' Ní Fhlannagáin @ 2023-11-23 13:49 UTC (permalink / raw)
To: openembedded-core
This commit tests for
https://bugzilla.yoctoproject.org/show_bug.cgi?id=13419
https://bugzilla.yoctoproject.org/show_bug.cgi?id=14961
Fixes for these are in following commits.
Signed-off-by: Eilís 'pidge' Ní Fhlannagáin <pidge@baylibre.com>
---
.../selftest-users/creategroup1.bb | 32 +++++++++++++++++++
.../selftest-users/creategroup2.bb | 32 +++++++++++++++++++
.../selftest-users/useraddbadtask.bb | 20 ++++++++++++
.../lib/oeqa/selftest/cases/usergrouptests.py | 32 +++++++++++++++++++
4 files changed, 116 insertions(+)
create mode 100644 meta-selftest/recipes-test/selftest-users/creategroup1.bb
create mode 100644 meta-selftest/recipes-test/selftest-users/creategroup2.bb
create mode 100644 meta-selftest/recipes-test/selftest-users/useraddbadtask.bb
create mode 100644 meta/lib/oeqa/selftest/cases/usergrouptests.py
diff --git a/meta-selftest/recipes-test/selftest-users/creategroup1.bb b/meta-selftest/recipes-test/selftest-users/creategroup1.bb
new file mode 100644
index 00000000000..2b0c443858c
--- /dev/null
+++ b/meta-selftest/recipes-test/selftest-users/creategroup1.bb
@@ -0,0 +1,32 @@
+SUMMARY = "creategroup pt 1"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+LICENSE = "MIT"
+
+DEPENDS:append = "coreutils-native"
+
+S = "${WORKDIR}"
+
+inherit useradd allarch
+
+USERADD_PACKAGES = "${PN}"
+USERADD_PARAM:${PN} = "-u 5555 --gid grouptest gt1"
+GROUPADD_PARAM:${PN} = "-r grouptest"
+
+TESTDIR = "${D}${sysconfdir}/creategroup"
+
+do_install() {
+ install -d ${TESTDIR}
+ install -d ${TESTDIR}/dir
+ touch ${TESTDIR}/file
+ ln -s ./file ${TESTDIR}/symlink
+ install -d ${TESTDIR}/fifotest
+ mkfifo ${TESTDIR}/fifotest/fifo
+ which chown
+ chown gt1:grouptest ${TESTDIR}/file
+ chown -R gt1:grouptest ${TESTDIR}/dir
+ chown -h gt1:grouptest ${TESTDIR}/symlink
+ chown -R gt1:grouptest ${TESTDIR}/fifotest
+}
+
+FILES:${PN} = "${sysconfdir}/creategroup/*"
diff --git a/meta-selftest/recipes-test/selftest-users/creategroup2.bb b/meta-selftest/recipes-test/selftest-users/creategroup2.bb
new file mode 100644
index 00000000000..6f25592c09f
--- /dev/null
+++ b/meta-selftest/recipes-test/selftest-users/creategroup2.bb
@@ -0,0 +1,32 @@
+SUMMARY = "creategroup pt 2"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+LICENSE = "MIT"
+
+DEPENDS:append = "coreutils-native creategroup1"
+
+S = "${WORKDIR}"
+
+inherit useradd allarch
+
+USERADD_PACKAGES = "${PN}"
+USERADD_PARAM:${PN} = "-u 5556 --gid grouptest gt2"
+
+TESTDIR = "${D}${sysconfdir}/creategroup"
+
+do_install() {
+ install -d ${TESTDIR}
+ install -d ${TESTDIR}/dir
+ touch ${TESTDIR}/file
+ ln -s ./file ${TESTDIR}/symlink
+ install -d ${TESTDIR}/fifotest
+ mkfifo ${TESTDIR}/fifotest/fifo
+
+ chown gt2:grouptest ${TESTDIR}/file
+ chown -R gt2:grouptest ${TESTDIR}/dir
+ chown -h gt2:grouptest ${TESTDIR}/symlink
+ chown -R gt2:grouptest ${TESTDIR}/fifotest
+}
+
+FILES:${PN} = "${sysconfdir}/creategroup/*"
+
diff --git a/meta-selftest/recipes-test/selftest-users/useraddbadtask.bb b/meta-selftest/recipes-test/selftest-users/useraddbadtask.bb
new file mode 100644
index 00000000000..99e04a80b34
--- /dev/null
+++ b/meta-selftest/recipes-test/selftest-users/useraddbadtask.bb
@@ -0,0 +1,20 @@
+SUMMARY = "UserAddBadTask"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+LICENSE = "MIT"
+
+DEPENDS:append = "coreutils-native"
+
+S = "${WORKDIR}"
+
+inherit useradd allarch
+
+USERADD_PACKAGES = "${PN}"
+USERADD_PARAM:${PN} = "-u 5555 --gid groupaddtask useraddtask"
+GROUPADD_PARAM:${PN} = "-r groupaddtask"
+
+do_badthingshappen() {
+ echo "foo"
+}
+
+addtask badthingshappen after do_populate_sysroot before do_package
diff --git a/meta/lib/oeqa/selftest/cases/usergrouptests.py b/meta/lib/oeqa/selftest/cases/usergrouptests.py
new file mode 100644
index 00000000000..14f7a0beab0
--- /dev/null
+++ b/meta/lib/oeqa/selftest/cases/usergrouptests.py
@@ -0,0 +1,32 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+from oeqa.selftest.case import OESelftestTestCase
+from oeqa.utils.commands import bitbake, get_bb_var
+import bb.utils
+import os
+
+class UserGroupTests(OESelftestTestCase):
+ def test_group_from_dep_package(self):
+ self.logger.info("Building creategroup2")
+ self.logger.info("Cleaning sstate for creategroup1 and creategroup2")
+ bitbake(' creategroup1 creategroup2 -f -c cleansstate')
+ self.logger.info("Building creategroup2")
+ bitbake(' creategroup2')
+ self.logger.info("Wiping out TMPDIR")
+ tmpdir = get_bb_var('TMPDIR')
+ if os.path.exists(tmpdir):
+ bb.utils.remove(tmpdir, recurse=True)
+ self.logger.info("Packaging creategroup2")
+ self.assertTrue(bitbake(' creategroup2 -c package'))
+
+ def test_add_task_between_p_sysroot_and_package(self):
+ self.logger.info("Cleaning sstate for useraddbadtask")
+ bitbake(' useraddbadtask -f -c cleansstate')
+ self.logger.info("Building useraddbadtask")
+ # This is expected to fail due to bug #14961
+ self.assertTrue(bitbake(' useraddbadtask'))
+
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [RFC 2/2] useradd.bbclass: ensure sysroot_setscene for DEPENDS
2023-11-23 13:48 [RFC 0/2] useradd improvements Eilís 'pidge' Ní Fhlannagáin
2023-11-23 13:49 ` [RFC 1/2] usergrouptests: Add initial useradd testing Eilís 'pidge' Ní Fhlannagáin
@ 2023-11-23 13:49 ` Eilís 'pidge' Ní Fhlannagáin
2023-11-23 14:11 ` [OE-core] " Richard Purdie
1 sibling, 1 reply; 8+ messages in thread
From: Eilís 'pidge' Ní Fhlannagáin @ 2023-11-23 13:49 UTC (permalink / raw)
To: openembedded-core
[YOCTO #13419]
If recipeB creates a user and assigns it to a group created in recipeA,
we need to ensure two things:
That recipeA is in recipeB's DEPENDS (documentation issue) and that the
sysroot setscene, in the case of a TMPDIR wipeout, is in
USERADDSETSCENEDEPS.
RP and I discussed adding a USERADD_DEPENDS variable to deal with this,
but there is some magic around DEPENDS that a new variable wouldn't have
so I'm sending this as is for people to poke at.
This commit should also fix issues seen in the following bugs:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=13279
https://bugzilla.yoctoproject.org/show_bug.cgi?id=13904
https://bugzilla.yoctoproject.org/show_bug.cgi?id=15084
Signed-off-by: Eilís 'pidge' Ní Fhlannagáin <pidge@baylibre.com>
---
meta/classes/useradd.bbclass | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass
index 4d3bd9a5f56..98c6999a0d2 100644
--- a/meta/classes/useradd.bbclass
+++ b/meta/classes/useradd.bbclass
@@ -177,6 +177,14 @@ SYSROOT_PREPROCESS_FUNCS += "${SYSROOTFUNC}"
SSTATEPREINSTFUNCS:append:class-target = " useradd_sysroot_sstate"
+python __anonymous() {
+ setscenedeps = ""
+ if "-native" not in d.getVar("PN"):
+ for pkg in d.getVar("DEPENDS").split():
+ setscenedeps += " %s:do_populate_sysroot_setscene " % pkg
+ d.setVar("USERADDSETSCENEDEPS", "%s %s" % (d.getVar("USERADDSETSCENEDEPS"), setscenedeps))
+}
+
do_package_setscene[depends] += "${USERADDSETSCENEDEPS}"
do_populate_sysroot_setscene[depends] += "${USERADDSETSCENEDEPS}"
USERADDSETSCENEDEPS:class-target = "${MLPREFIX}base-passwd:do_populate_sysroot_setscene pseudo-native:do_populate_sysroot_setscene shadow-native:do_populate_sysroot_setscene ${MLPREFIX}shadow-sysroot:do_populate_sysroot_setscene"
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [OE-core] [RFC 2/2] useradd.bbclass: ensure sysroot_setscene for DEPENDS
2023-11-23 13:49 ` [RFC 2/2] useradd.bbclass: ensure sysroot_setscene for DEPENDS Eilís 'pidge' Ní Fhlannagáin
@ 2023-11-23 14:11 ` Richard Purdie
2023-11-24 14:10 ` Eilís 'pidge' Ní Fhlannagáin
0 siblings, 1 reply; 8+ messages in thread
From: Richard Purdie @ 2023-11-23 14:11 UTC (permalink / raw)
To: Eilís 'pidge' Ní Fhlannagáin,
openembedded-core
On Thu, 2023-11-23 at 13:49 +0000, Eilís 'pidge' Ní Fhlannagáin wrote:
> [YOCTO #13419]
>
> If recipeB creates a user and assigns it to a group created in recipeA,
> we need to ensure two things:
>
> That recipeA is in recipeB's DEPENDS (documentation issue) and that the
> sysroot setscene, in the case of a TMPDIR wipeout, is in
> USERADDSETSCENEDEPS.
>
> RP and I discussed adding a USERADD_DEPENDS variable to deal with this,
> but there is some magic around DEPENDS that a new variable wouldn't have
> so I'm sending this as is for people to poke at.
Can you be more specific about this "magic"?
I'm still worrying that DEPENDS is too broad, there are many more
things in there which we don't want listed as setscene dependencies and
I think this needs to be more precise.
Cheers,
Richard
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [OE-core] [RFC 2/2] useradd.bbclass: ensure sysroot_setscene for DEPENDS
2023-11-23 14:11 ` [OE-core] " Richard Purdie
@ 2023-11-24 14:10 ` Eilís 'pidge' Ní Fhlannagáin
2023-11-25 15:21 ` Eilís 'pidge' Ní Fhlannagáin
0 siblings, 1 reply; 8+ messages in thread
From: Eilís 'pidge' Ní Fhlannagáin @ 2023-11-24 14:10 UTC (permalink / raw)
To: Richard Purdie, openembedded-core
On 23/11/2023 14:11, Richard Purdie wrote:
> On Thu, 2023-11-23 at 13:49 +0000, Eilís 'pidge' Ní Fhlannagáin wrote:
>> [YOCTO #13419]
>>
>> If recipeB creates a user and assigns it to a group created in recipeA,
>> we need to ensure two things:
>>
>> That recipeA is in recipeB's DEPENDS (documentation issue) and that the
>> sysroot setscene, in the case of a TMPDIR wipeout, is in
>> USERADDSETSCENEDEPS.
>>
>> RP and I discussed adding a USERADD_DEPENDS variable to deal with this,
>> but there is some magic around DEPENDS that a new variable wouldn't have
>> so I'm sending this as is for people to poke at.
>
> Can you be more specific about this "magic"?
>
> I'm still worrying that DEPENDS is too broad, there are many more
> things in there which we don't want listed as setscene dependencies and
> I think this needs to be more precise.
>
> Cheers,
>
> Richard
The interesting thing here is if we do something like:
python __anonymous() {
setscenedeps = ""
if "-native" not in d.getVar("PN") and d.getVar("USERADD_DEPENDS")
is not None:
for pkg in d.getVar("USERADD_DEPENDS").split():
setscenedeps += " %s:do_populate_sysroot_setscene " % pkg
d.setVar("USERADDSETSCENEDEPS", "%s %s" %
(d.getVar("USERADDSETSCENEDEPS"), setscenedeps))
}
we end up throwing:
ERROR: creategroup2-1.0-r0 do_prepare_recipe_sysroot: The sstate
manifest for task 'creategroup1:populate_sysroot' (multilib variant '')
could not be found.
The pkgarchs considered were: qemux86_64, core2-64, x86_64, allarch,
none_none-nativesdk.
But none of these manifests exists:
/home/pidge/poky/build/tmp/sstate-control/manifest-qemux86_64-creategroup1.populate_sysroot
/home/pidge/poky/build/tmp/sstate-control/manifest-core2-64-creategroup1.populate_sysroot
/home/pidge/poky/build/tmp/sstate-control/manifest-x86_64-creategroup1.populate_sysroot
/home/pidge/poky/build/tmp/sstate-control/manifest-allarch-creategroup1.populate_sysroot
/home/pidge/poky/build/tmp/sstate-control/manifest-none_none-nativesdk-creategroup1.populate_sysroot
The weird thing (hence this being an RFC), is that the patch I sent
doesn't throw this. At first, I thought it was something happening with
a polluted sstate but I don't think so now. I am absolutely unsure as to
why that would be, BUT my suspicion is that this error is related to
14961 (which I'm still poking at).
--
Eilís 'pidge' Ní Fhlannagáin
BayLibre - At the Heart of Embedded Linux
www.baylibre.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [OE-core] [RFC 2/2] useradd.bbclass: ensure sysroot_setscene for DEPENDS
2023-11-24 14:10 ` Eilís 'pidge' Ní Fhlannagáin
@ 2023-11-25 15:21 ` Eilís 'pidge' Ní Fhlannagáin
2023-11-25 22:03 ` Eilís 'pidge' Ní Fhlannagáin
0 siblings, 1 reply; 8+ messages in thread
From: Eilís 'pidge' Ní Fhlannagáin @ 2023-11-25 15:21 UTC (permalink / raw)
To: Richard Purdie, openembedded-core
On 24/11/2023 14:10, Eilís 'pidge' Ní Fhlannagáin wrote:
> On 23/11/2023 14:11, Richard Purdie wrote:
>> On Thu, 2023-11-23 at 13:49 +0000, Eilís 'pidge' Ní Fhlannagáin wrote:
>>> [YOCTO #13419]
>>>
>>> If recipeB creates a user and assigns it to a group created in recipeA,
>>> we need to ensure two things:
>>>
>>> That recipeA is in recipeB's DEPENDS (documentation issue) and that the
>>> sysroot setscene, in the case of a TMPDIR wipeout, is in
>>> USERADDSETSCENEDEPS.
>>>
>>> RP and I discussed adding a USERADD_DEPENDS variable to deal with this,
>>> but there is some magic around DEPENDS that a new variable wouldn't have
>>> so I'm sending this as is for people to poke at.
>>
>> Can you be more specific about this "magic"?
>>
>> I'm still worrying that DEPENDS is too broad, there are many more
>> things in there which we don't want listed as setscene dependencies and
>> I think this needs to be more precise.
>>
>> Cheers,
>>
>> Richard
>
> The interesting thing here is if we do something like:
>
> python __anonymous() {
> setscenedeps = ""
> if "-native" not in d.getVar("PN") and d.getVar("USERADD_DEPENDS")
> is not None:
> for pkg in d.getVar("USERADD_DEPENDS").split():
> setscenedeps += " %s:do_populate_sysroot_setscene " % pkg
> d.setVar("USERADDSETSCENEDEPS", "%s %s" %
> (d.getVar("USERADDSETSCENEDEPS"), setscenedeps))
> }
>
> we end up throwing:
>
> ERROR: creategroup2-1.0-r0 do_prepare_recipe_sysroot: The sstate
> manifest for task 'creategroup1:populate_sysroot' (multilib variant '')
> could not be found.
> The pkgarchs considered were: qemux86_64, core2-64, x86_64, allarch,
> none_none-nativesdk.
> But none of these manifests exists:
>
> /home/pidge/poky/build/tmp/sstate-control/manifest-qemux86_64-creategroup1.populate_sysroot
>
> /home/pidge/poky/build/tmp/sstate-control/manifest-core2-64-creategroup1.populate_sysroot
>
> /home/pidge/poky/build/tmp/sstate-control/manifest-x86_64-creategroup1.populate_sysroot
>
> /home/pidge/poky/build/tmp/sstate-control/manifest-allarch-creategroup1.populate_sysroot
>
> /home/pidge/poky/build/tmp/sstate-control/manifest-none_none-nativesdk-creategroup1.populate_sysroot
>
> The weird thing (hence this being an RFC), is that the patch I sent
> doesn't throw this. At first, I thought it was something happening with
> a polluted sstate but I don't think so now. I am absolutely unsure as to
> why that would be, BUT my suspicion is that this error is related to
> 14961 (which I'm still poking at).
>
I had a crack at this tonight. Interestingly enough, limiting the code
"fixes" the issue, eg and allows us to use USERADD_DEPENDS:
if "-native" not in d.getVar("PN") and d.getVar("USERADD_DEPENDS") is
not None and d.getVar("BB_CURRENTTASK") == "package":
I guess my question is why would it work with DEPENDS but fail with
USERADD_DEPENDS unless we limited to do_package? (hence the magic I'm
seeing). I'm still guessing this is something in staging.bbclass that is
doing something funny.
--
Eilís 'pidge' Ní Fhlannagáin
BayLibre - At the Heart of Embedded Linux
www.baylibre.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [OE-core] [RFC 2/2] useradd.bbclass: ensure sysroot_setscene for DEPENDS
2023-11-25 15:21 ` Eilís 'pidge' Ní Fhlannagáin
@ 2023-11-25 22:03 ` Eilís 'pidge' Ní Fhlannagáin
0 siblings, 0 replies; 8+ messages in thread
From: Eilís 'pidge' Ní Fhlannagáin @ 2023-11-25 22:03 UTC (permalink / raw)
To: Richard Purdie, openembedded-core
On 25/11/2023 15:21, Eilís 'pidge' Ní Fhlannagáin wrote:
> On 24/11/2023 14:10, Eilís 'pidge' Ní Fhlannagáin wrote:
>> On 23/11/2023 14:11, Richard Purdie wrote:
>>> On Thu, 2023-11-23 at 13:49 +0000, Eilís 'pidge' Ní Fhlannagáin wrote:
>>>> [YOCTO #13419]
>>>>
>>>> If recipeB creates a user and assigns it to a group created in recipeA,
>>>> we need to ensure two things:
>>>>
>>>> That recipeA is in recipeB's DEPENDS (documentation issue) and that the
>>>> sysroot setscene, in the case of a TMPDIR wipeout, is in
>>>> USERADDSETSCENEDEPS.
>>>>
>>>> RP and I discussed adding a USERADD_DEPENDS variable to deal with this,
>>>> but there is some magic around DEPENDS that a new variable wouldn't
>>>> have
>>>> so I'm sending this as is for people to poke at.
>>>
>>> Can you be more specific about this "magic"?
>>>
>>> I'm still worrying that DEPENDS is too broad, there are many more
>>> things in there which we don't want listed as setscene dependencies and
>>> I think this needs to be more precise.
>>>
>>> Cheers,
>>>
>>> Richard
>>
>> The interesting thing here is if we do something like:
>>
>> python __anonymous() {
>> setscenedeps = ""
>> if "-native" not in d.getVar("PN") and
>> d.getVar("USERADD_DEPENDS") is not None:
>> for pkg in d.getVar("USERADD_DEPENDS").split():
>> setscenedeps += " %s:do_populate_sysroot_setscene " % pkg
>> d.setVar("USERADDSETSCENEDEPS", "%s %s" %
>> (d.getVar("USERADDSETSCENEDEPS"), setscenedeps))
>> }
>>
>> we end up throwing:
>>
>> ERROR: creategroup2-1.0-r0 do_prepare_recipe_sysroot: The sstate
>> manifest for task 'creategroup1:populate_sysroot' (multilib variant
>> '') could not be found.
>> The pkgarchs considered were: qemux86_64, core2-64, x86_64, allarch,
>> none_none-nativesdk.
>> But none of these manifests exists:
>>
>> /home/pidge/poky/build/tmp/sstate-control/manifest-qemux86_64-creategroup1.populate_sysroot
>>
>> /home/pidge/poky/build/tmp/sstate-control/manifest-core2-64-creategroup1.populate_sysroot
>>
>> /home/pidge/poky/build/tmp/sstate-control/manifest-x86_64-creategroup1.populate_sysroot
>>
>> /home/pidge/poky/build/tmp/sstate-control/manifest-allarch-creategroup1.populate_sysroot
>>
>> /home/pidge/poky/build/tmp/sstate-control/manifest-none_none-nativesdk-creategroup1.populate_sysroot
>>
>> The weird thing (hence this being an RFC), is that the patch I sent
>> doesn't throw this. At first, I thought it was something happening
>> with a polluted sstate but I don't think so now. I am absolutely
>> unsure as to why that would be, BUT my suspicion is that this error is
>> related to 14961 (which I'm still poking at).
>>
>
> I had a crack at this tonight. Interestingly enough, limiting the code
> "fixes" the issue, eg and allows us to use USERADD_DEPENDS:
>
> if "-native" not in d.getVar("PN") and d.getVar("USERADD_DEPENDS") is
> not None and d.getVar("BB_CURRENTTASK") == "package":
>
> I guess my question is why would it work with DEPENDS but fail with
> USERADD_DEPENDS unless we limited to do_package? (hence the magic I'm
> seeing). I'm still guessing this is something in staging.bbclass that is
> doing something funny.
>
A bit more on this. The above is incorrect in that DEPENDS certainly is
special in this context (I had inadvertently switched to 'bitbake -f -c
package').
Not using the useradd patch works with -f -c (which makes sense)
So initial patch works with either -f -c or -c
Subsequent USERADD_DEPENDS code works with -f -c only.
Which tells me that there is something special about basing the patch on
DEPENDS which isn't doing what USERADD_DEPENDS is doing, which again
points to something deep in staging.
-e
--
Eilís 'pidge' Ní Fhlannagáin
BayLibre - At the Heart of Embedded Linux
www.baylibre.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [OE-core] [RFC 1/2] usergrouptests: Add initial useradd testing
2023-11-23 13:49 ` [RFC 1/2] usergrouptests: Add initial useradd testing Eilís 'pidge' Ní Fhlannagáin
@ 2023-11-27 14:40 ` Richard Purdie
0 siblings, 0 replies; 8+ messages in thread
From: Richard Purdie @ 2023-11-27 14:40 UTC (permalink / raw)
To: Eilís 'pidge' Ní Fhlannagáin,
openembedded-core
On Thu, 2023-11-23 at 13:49 +0000, Eilís 'pidge' Ní Fhlannagáin wrote:
> This commit tests for
> https://bugzilla.yoctoproject.org/show_bug.cgi?id=13419
> https://bugzilla.yoctoproject.org/show_bug.cgi?id=14961
>
> Fixes for these are in following commits.
>
> Signed-off-by: Eilís 'pidge' Ní Fhlannagáin <pidge@baylibre.com>
> ---
> .../selftest-users/creategroup1.bb | 32 +++++++++++++++++++
> .../selftest-users/creategroup2.bb | 32 +++++++++++++++++++
> .../selftest-users/useraddbadtask.bb | 20 ++++++++++++
> .../lib/oeqa/selftest/cases/usergrouptests.py | 32 +++++++++++++++++++
> 4 files changed, 116 insertions(+)
> create mode 100644 meta-selftest/recipes-test/selftest-users/creategroup1.bb
> create mode 100644 meta-selftest/recipes-test/selftest-users/creategroup2.bb
> create mode 100644 meta-selftest/recipes-test/selftest-users/useraddbadtask.bb
> create mode 100644 meta/lib/oeqa/selftest/cases/usergrouptests.py
>
> diff --git a/meta-selftest/recipes-test/selftest-users/creategroup1.bb b/meta-selftest/recipes-test/selftest-users/creategroup1.bb
> new file mode 100644
> index 00000000000..2b0c443858c
> --- /dev/null
> +++ b/meta-selftest/recipes-test/selftest-users/creategroup1.bb
> @@ -0,0 +1,32 @@
> +SUMMARY = "creategroup pt 1"
> +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
> +
> +LICENSE = "MIT"
> +
> +DEPENDS:append = "coreutils-native"
> +
> +S = "${WORKDIR}"
> +
> +inherit useradd allarch
> +
> +USERADD_PACKAGES = "${PN}"
> +USERADD_PARAM:${PN} = "-u 5555 --gid grouptest gt1"
> +GROUPADD_PARAM:${PN} = "-r grouptest"
> +
> +TESTDIR = "${D}${sysconfdir}/creategroup"
> +
> +do_install() {
> + install -d ${TESTDIR}
> + install -d ${TESTDIR}/dir
> + touch ${TESTDIR}/file
> + ln -s ./file ${TESTDIR}/symlink
> + install -d ${TESTDIR}/fifotest
> + mkfifo ${TESTDIR}/fifotest/fifo
> + which chown
> + chown gt1:grouptest ${TESTDIR}/file
> + chown -R gt1:grouptest ${TESTDIR}/dir
> + chown -h gt1:grouptest ${TESTDIR}/symlink
> + chown -R gt1:grouptest ${TESTDIR}/fifotest
> +}
> +
> +FILES:${PN} = "${sysconfdir}/creategroup/*"
> diff --git a/meta-selftest/recipes-test/selftest-users/creategroup2.bb b/meta-selftest/recipes-test/selftest-users/creategroup2.bb
> new file mode 100644
> index 00000000000..6f25592c09f
> --- /dev/null
> +++ b/meta-selftest/recipes-test/selftest-users/creategroup2.bb
> @@ -0,0 +1,32 @@
> +SUMMARY = "creategroup pt 2"
> +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
> +
> +LICENSE = "MIT"
> +
> +DEPENDS:append = "coreutils-native creategroup1"
> +
> +S = "${WORKDIR}"
> +
> +inherit useradd allarch
> +
> +USERADD_PACKAGES = "${PN}"
> +USERADD_PARAM:${PN} = "-u 5556 --gid grouptest gt2"
> +
> +TESTDIR = "${D}${sysconfdir}/creategroup"
> +
> +do_install() {
> + install -d ${TESTDIR}
> + install -d ${TESTDIR}/dir
> + touch ${TESTDIR}/file
> + ln -s ./file ${TESTDIR}/symlink
> + install -d ${TESTDIR}/fifotest
> + mkfifo ${TESTDIR}/fifotest/fifo
> +
> + chown gt2:grouptest ${TESTDIR}/file
> + chown -R gt2:grouptest ${TESTDIR}/dir
> + chown -h gt2:grouptest ${TESTDIR}/symlink
> + chown -R gt2:grouptest ${TESTDIR}/fifotest
> +}
> +
> +FILES:${PN} = "${sysconfdir}/creategroup/*"
> +
> diff --git a/meta-selftest/recipes-test/selftest-users/useraddbadtask.bb b/meta-selftest/recipes-test/selftest-users/useraddbadtask.bb
> new file mode 100644
> index 00000000000..99e04a80b34
> --- /dev/null
> +++ b/meta-selftest/recipes-test/selftest-users/useraddbadtask.bb
> @@ -0,0 +1,20 @@
> +SUMMARY = "UserAddBadTask"
> +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
> +
> +LICENSE = "MIT"
> +
> +DEPENDS:append = "coreutils-native"
> +
> +S = "${WORKDIR}"
> +
> +inherit useradd allarch
> +
> +USERADD_PACKAGES = "${PN}"
> +USERADD_PARAM:${PN} = "-u 5555 --gid groupaddtask useraddtask"
> +GROUPADD_PARAM:${PN} = "-r groupaddtask"
> +
> +do_badthingshappen() {
> + echo "foo"
> +}
> +
> +addtask badthingshappen after do_populate_sysroot before do_package
> diff --git a/meta/lib/oeqa/selftest/cases/usergrouptests.py b/meta/lib/oeqa/selftest/cases/usergrouptests.py
> new file mode 100644
> index 00000000000..14f7a0beab0
> --- /dev/null
> +++ b/meta/lib/oeqa/selftest/cases/usergrouptests.py
> @@ -0,0 +1,32 @@
> +#
> +# Copyright OpenEmbedded Contributors
> +#
> +# SPDX-License-Identifier: MIT
> +#
> +
> +from oeqa.selftest.case import OESelftestTestCase
> +from oeqa.utils.commands import bitbake, get_bb_var
> +import bb.utils
> +import os
> +
> +class UserGroupTests(OESelftestTestCase):
> + def test_group_from_dep_package(self):
> + self.logger.info("Building creategroup2")
> + self.logger.info("Cleaning sstate for creategroup1 and creategroup2")
> + bitbake(' creategroup1 creategroup2 -f -c cleansstate')
Unfortunately this test isn't safe for a shared sstate cache like we
have on the autobuilder since we should never use cleansstate there
without special handling (isolated cache). You would also never need -f
with clean*.
Instead you could do something like a "bitbake creategroup2 -C fetch"
if you always want it to rebuild.
Cheers,
Richard
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-11-27 14:40 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-23 13:48 [RFC 0/2] useradd improvements Eilís 'pidge' Ní Fhlannagáin
2023-11-23 13:49 ` [RFC 1/2] usergrouptests: Add initial useradd testing Eilís 'pidge' Ní Fhlannagáin
2023-11-27 14:40 ` [OE-core] " Richard Purdie
2023-11-23 13:49 ` [RFC 2/2] useradd.bbclass: ensure sysroot_setscene for DEPENDS Eilís 'pidge' Ní Fhlannagáin
2023-11-23 14:11 ` [OE-core] " Richard Purdie
2023-11-24 14:10 ` Eilís 'pidge' Ní Fhlannagáin
2023-11-25 15:21 ` Eilís 'pidge' Ní Fhlannagáin
2023-11-25 22:03 ` Eilís 'pidge' Ní Fhlannagáin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox