From d00682ab5c2d472b2fdddfe86198dc2816028359 Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Fri, 26 Jan 2024 14:34:50 +0100 Subject: classes/staging: capture output of sysroot postinsts into logs This particularly helps with user management postinsts as otherwise there's no trace left of what was run, in which order, and what was the output. Here's an example from the logs: NOTE: Running postinst /srv/storage/alex/yocto/build-multilib/tmp/work/x86_64-pokymllib64-linux/lib64-quilt/0.67/lib64-recipe-sysroot/usr/bin/postinst-lib64-base-passwd, output: b'/srv/storage/alex/yocto/build-multilib/tmp/work/x86_64-pokymllib64-linux/lib64-quilt/0.67/recipe-sysroot-native/usr/sbin/useradd\nRunning useradd commands...\nNOTE: lib64-ptest-runner: Performing useradd with [--root /srv/storage/alex/yocto/build-multilib/tmp/work/x86_64-pokymllib64-linux/lib64-quilt/0.67/lib64-recipe-sysroot --system --no-create-home --home / --user-group ptest]\n' NOTE: Running postinst /srv/storage/alex/yocto/build-multilib/tmp/work/x86_64-pokymllib64-linux/lib64-quilt/0.67/lib64-recipe-sysroot/usr/bin/postinst-useradd-lib64-ptest-runner, output: b'/srv/storage/alex/yocto/build-multilib/tmp/work/x86_64-pokymllib64-linux/lib64-quilt/0.67/recipe-sysroot-native/usr/sbin/useradd\nRunning useradd commands...\nNOTE: lib64-ptest-runner: Performing useradd with [--root /srv/storage/alex/yocto/build-multilib/tmp/work/x86_64-pokymllib64-linux/lib64-quilt/0.67/lib64-recipe-sysroot --system --no-create-home --home / --user-group ptest]\nNOTE: lib64-ptest-runner: user ptest already exists, not re-creating it\n' (From OE-Core rev: a4dc96293268804b214a02e08d266205fad428b0) Signed-off-by: Alexander Kanavin Signed-off-by: Richard Purdie --- meta/classes-global/staging.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'meta/classes-global') diff --git a/meta/classes-global/staging.bbclass b/meta/classes-global/staging.bbclass index cf1e4600fd..ab3e1d71b5 100644 --- a/meta/classes-global/staging.bbclass +++ b/meta/classes-global/staging.bbclass @@ -246,7 +246,7 @@ def staging_populate_sysroot_dir(targetsysroot, nativesysroot, native, d): staging_processfixme(fixme, targetdir, targetsysroot, nativesysroot, d) for p in postinsts: - subprocess.check_output(p, shell=True, stderr=subprocess.STDOUT) + bb.note("Running postinst {}, output:\n{}".format(p, subprocess.check_output(p, shell=True, stderr=subprocess.STDOUT))) # # Manifests here are complicated. The main sysroot area has the unpacked sstate @@ -630,7 +630,7 @@ python extend_recipe_sysroot() { staging_processfixme(fixme[f], f, recipesysroot, recipesysrootnative, d) for p in postinsts: - subprocess.check_output(p, shell=True, stderr=subprocess.STDOUT) + bb.note("Running postinst {}, output:\n{}".format(p, subprocess.check_output(p, shell=True, stderr=subprocess.STDOUT))) for dep in manifests: c = setscenedeps[dep][0] -- cgit v1.2.3-54-g00ecf