diff mbox series

[2/2] quilt,cpio: Create ptest user when ptest is enabled in distro features

Message ID 20240104021052.754030-2-raj.khem@gmail.com
State New
Headers show
Series [1/2] Revert "opkg-utils: upgrade 0.6.2 -> 0.6.3" | expand

Commit Message

Khem Raj Jan. 4, 2024, 2:10 a.m. UTC
Fixes warnings

run.do_install_ptest_base.107960:175 exit 1 from 'chgrp -R ptest /mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/cpio/2.14/image/usr/lib/cpio/ptest/'

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/quilt/quilt.inc   |  8 ++++----
 meta/recipes-extended/cpio/cpio_2.14.bb | 11 +++++------
 2 files changed, 9 insertions(+), 10 deletions(-)

Comments

Ross Burton Jan. 9, 2024, 4:05 p.m. UTC | #1
On 4 Jan 2024, at 02:10, Khem Raj via lists.openembedded.org <raj.khem=gmail.com@lists.openembedded.org> wrote:
> -# The tests need to run as a non-root user, so pull in the ptest user
> -DEPENDS:append:class-target = "${@bb.utils.contains('PTEST_ENABLED', '1', ' ptest-runner', '', d)}"
> -PACKAGE_WRITE_DEPS += "ptest-runner"
> +# The tests need to run as a non-root user
> +USERADD_PACKAGES = "${PN}-ptest"
> +USERADD_PARAM:${PN}-ptest = "--system --home /nonexistent --no-create-home --user-group ptest”

The original lines were intended to pull in the ptest user that the ptest-runner recipe creates.  Why is that not sufficient?

Ross
Khem Raj Jan. 9, 2024, 6:42 p.m. UTC | #2
lets drop this patch. The issue with chgrp seems to be gone, must have
been transitory as I was narrowing down the opkg-utils bug.

On Tue, Jan 9, 2024 at 8:05 AM Ross Burton <Ross.Burton@arm.com> wrote:
>
> On 4 Jan 2024, at 02:10, Khem Raj via lists.openembedded.org <raj.khem=gmail.com@lists.openembedded.org> wrote:
> > -# The tests need to run as a non-root user, so pull in the ptest user
> > -DEPENDS:append:class-target = "${@bb.utils.contains('PTEST_ENABLED', '1', ' ptest-runner', '', d)}"
> > -PACKAGE_WRITE_DEPS += "ptest-runner"
> > +# The tests need to run as a non-root user
> > +USERADD_PACKAGES = "${PN}-ptest"
> > +USERADD_PARAM:${PN}-ptest = "--system --home /nonexistent --no-create-home --user-group ptest”
>
> The original lines were intended to pull in the ptest user that the ptest-runner recipe creates.  Why is that not sufficient?
>
> Ross
diff mbox series

Patch

diff --git a/meta/recipes-devtools/quilt/quilt.inc b/meta/recipes-devtools/quilt/quilt.inc
index 3374f4dfbf3..89572d70d7c 100644
--- a/meta/recipes-devtools/quilt/quilt.inc
+++ b/meta/recipes-devtools/quilt/quilt.inc
@@ -20,7 +20,7 @@  SRC_URI:append:class-target = " file://gnu_patch_test_fix_target.patch"
 
 SRC_URI[sha256sum] = "3be3be0987e72a6c364678bb827e3e1fcc10322b56bc5f02b576698f55013cc2"
 
-inherit autotools-brokensep ptest
+inherit autotools-brokensep ptest useradd
 
 INHIBIT_AUTOTOOLS_DEPS:class-native = "1"
 PATCHTOOL:class-native = "patch"
@@ -62,9 +62,9 @@  do_install:append:class-native () {
     touch ${D}${sysconfdir}/quiltrc
 }
 
-# The tests need to run as a non-root user, so pull in the ptest user
-DEPENDS:append:class-target = "${@bb.utils.contains('PTEST_ENABLED', '1', ' ptest-runner', '', d)}"
-PACKAGE_WRITE_DEPS += "ptest-runner"
+# The tests need to run as a non-root user
+USERADD_PACKAGES = "${PN}-ptest"
+USERADD_PARAM:${PN}-ptest = "--system --home /nonexistent --no-create-home --user-group ptest"
 
 do_install_ptest() {
 	install ${WORKDIR}/test.sh ${D}${PTEST_PATH}
diff --git a/meta/recipes-extended/cpio/cpio_2.14.bb b/meta/recipes-extended/cpio/cpio_2.14.bb
index 560038d2a67..c6ab0054994 100644
--- a/meta/recipes-extended/cpio/cpio_2.14.bb
+++ b/meta/recipes-extended/cpio/cpio_2.14.bb
@@ -14,7 +14,7 @@  SRC_URI = "${GNU_MIRROR}/cpio/cpio-${PV}.tar.gz \
 
 SRC_URI[sha256sum] = "145a340fd9d55f0b84779a44a12d5f79d77c99663967f8cfa168d7905ca52454"
 
-inherit autotools gettext texinfo ptest
+inherit autotools gettext texinfo ptest useradd
 
 CVE_STATUS[CVE-2010-4226] = "not-applicable-platform: Issue applies to use of cpio in SUSE/OBS"
 
@@ -63,11 +63,10 @@  do_install_ptest_base:append() {
     chmod -R g+w ${D}${PTEST_PATH}/
 }
 
-# The tests need to run as a non-root user, so pull in the ptest user
-DEPENDS:append:class-target = "${@bb.utils.contains('PTEST_ENABLED', '1', ' ptest-runner', '', d)}"
-PACKAGE_WRITE_DEPS:append:class-target = " ${MLPREFIX}ptest-runner"
-
-RDEPENDS:${PN}-ptest += "ptest-runner"
+# The tests need to run as a non-root user
+USERADD_PACKAGES = "${PN}-ptest"
+USERADD_PARAM:${PN}-ptest = "--system --home /nonexistent --no-create-home \
+                       --user-group ptest"
 
 PACKAGES =+ "${PN}-rmt"