[OE-core] [PATCH 1/2] useradd.bbclass: Make postinst functions verbose if BB_VERBOSE_LOGS is set
Peter Kjellerstedt
peter.kjellerstedt at axis.com
Fri Apr 14 02:39:53 UTC 2017
If BB_VERBOSE_LOGS is enabled, then make the postinst functions use
set -x so that their execution is traced. This greatly simplifies
debugging, especially in case of failures as nothing is recorded in
the logs otherwise to indicate what caused the failure.
Also reduce code duplication in useradd_sysroot_sstate() by only
having one copy of the code to create the postinst files.
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt at axis.com>
---
meta/classes/useradd.bbclass | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass
index 4373677bd6..d9b5373d96 100644
--- a/meta/classes/useradd.bbclass
+++ b/meta/classes/useradd.bbclass
@@ -133,26 +133,25 @@ useradd_sysroot () {
}
python useradd_sysroot_sstate () {
+ scriptfile = None
task = d.getVar("BB_CURRENTTASK")
if task == "package_setscene":
bb.build.exec_func("useradd_sysroot", d)
elif task == "prepare_recipe_sysroot":
# Used to update this recipe's own sysroot so the user/groups are available to do_install
scriptfile = d.expand("${RECIPE_SYSROOT}${bindir}/postinst-useradd-${PN}")
- bb.utils.mkdirhier(os.path.dirname(scriptfile))
- with open(scriptfile, 'w') as script:
- script.write("#!/bin/sh\n")
- bb.data.emit_func("useradd_sysroot", script, d)
- script.write("useradd_sysroot\n")
- os.chmod(scriptfile, 0o755)
bb.build.exec_func("useradd_sysroot", d)
elif task == "populate_sysroot":
# Used when installed in dependent task sysroots
scriptfile = d.expand("${SYSROOT_DESTDIR}${bindir}/postinst-useradd-${PN}")
+
+ if scriptfile:
bb.utils.mkdirhier(os.path.dirname(scriptfile))
with open(scriptfile, 'w') as script:
script.write("#!/bin/sh\n")
bb.data.emit_func("useradd_sysroot", script, d)
+ if bb.msg.loggerVerboseLogs:
+ script.write("set -x\n")
script.write("useradd_sysroot\n")
os.chmod(scriptfile, 0o755)
}
--
2.12.0
More information about the Openembedded-core
mailing list