All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Allow postinst functions to be verbose
@ 2017-04-14  2:39 Peter Kjellerstedt
  2017-04-14  2:39 ` [PATCH 1/2] useradd.bbclass: Make postinst functions verbose if BB_VERBOSE_LOGS is set Peter Kjellerstedt
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Peter Kjellerstedt @ 2017-04-14  2:39 UTC (permalink / raw)
  To: openembedded-core

This enables tracing of the postinst functions created in base-passwd
and useradd.bbclass if BB_VERBOSE_LOGS is enabled. I found this
extremely useful during verification of the useradd functionality,
especially as there otherwise is absolutely nothing in the logs of why
a failure in a postinst function happened.

I also simplified useradd_sysroot_sstate() by only having the code to
create the postinst files once.

Feel free to squash these commits with the "base-passwd/useradd:
Various improvements to useradd with RSS" commit if you prefer.

//Peter

The following changes since commit 79ac98550f0aa25940404a9805c12744f7047c76:

  base-passwd/useradd: Various improvements to useradd with RSS (2017-04-14 00:03:19 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib pkj/verbose_postinst
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=pkj/verbose_postinst

Peter Kjellerstedt (2):
  useradd.bbclass: Make postinst functions verbose if BB_VERBOSE_LOGS is
    set
  base-passwd: Make the postinst function verbose if BB_VERBOSE_LOGS is
    set

 meta/classes/useradd.bbclass                        | 11 +++++------
 meta/recipes-core/base-passwd/base-passwd_3.5.29.bb |  2 ++
 2 files changed, 7 insertions(+), 6 deletions(-)

-- 
2.12.0



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] useradd.bbclass: Make postinst functions verbose if BB_VERBOSE_LOGS is set
  2017-04-14  2:39 [PATCH 0/2] Allow postinst functions to be verbose Peter Kjellerstedt
@ 2017-04-14  2:39 ` Peter Kjellerstedt
  2017-04-14  2:39 ` [PATCH 2/2] base-passwd: Make the postinst function " Peter Kjellerstedt
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Peter Kjellerstedt @ 2017-04-14  2:39 UTC (permalink / raw)
  To: openembedded-core

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@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



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] base-passwd: Make the postinst function verbose if BB_VERBOSE_LOGS is set
  2017-04-14  2:39 [PATCH 0/2] Allow postinst functions to be verbose Peter Kjellerstedt
  2017-04-14  2:39 ` [PATCH 1/2] useradd.bbclass: Make postinst functions verbose if BB_VERBOSE_LOGS is set Peter Kjellerstedt
@ 2017-04-14  2:39 ` Peter Kjellerstedt
  2017-04-14  3:01 ` ✗ patchtest: failure for Allow postinst functions to be verbose Patchwork
  2017-04-14  8:49 ` [PATCH 0/2] " Richard Purdie
  3 siblings, 0 replies; 7+ messages in thread
From: Peter Kjellerstedt @ 2017-04-14  2:39 UTC (permalink / raw)
  To: openembedded-core

If BB_VERBOSE_LOGS is enabled, then make the postinst function use
set -x so that its 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.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 meta/recipes-core/base-passwd/base-passwd_3.5.29.bb | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb b/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb
index c6be1c1d08..0d5deee7d0 100644
--- a/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb
+++ b/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb
@@ -46,6 +46,8 @@ do_install () {
 basepasswd_sysroot_postinst() {
 #!/bin/sh
 
+${@"set -x" if bb.msg.loggerVerboseLogs else ""}
+
 # Install passwd.master and group.master to sysconfdir
 install -d -m 755 ${STAGING_DIR_TARGET}${sysconfdir}
 for i in passwd group; do
-- 
2.12.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* ✗ patchtest: failure for Allow postinst functions to be verbose
  2017-04-14  2:39 [PATCH 0/2] Allow postinst functions to be verbose Peter Kjellerstedt
  2017-04-14  2:39 ` [PATCH 1/2] useradd.bbclass: Make postinst functions verbose if BB_VERBOSE_LOGS is set Peter Kjellerstedt
  2017-04-14  2:39 ` [PATCH 2/2] base-passwd: Make the postinst function " Peter Kjellerstedt
@ 2017-04-14  3:01 ` Patchwork
  2017-04-14  8:49 ` [PATCH 0/2] " Richard Purdie
  3 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2017-04-14  3:01 UTC (permalink / raw)
  To: Peter Kjellerstedt; +Cc: openembedded-core

== Series Details ==

Series: Allow postinst functions to be verbose
Revision: 1
URL   : https://patchwork.openembedded.org/series/6370/
State : failure

== Summary ==


Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following failures:



* Issue             Series does not apply on top of target branch [test_series_merge_on_head] 
  Suggested fix    Rebase your series on top of targeted branch
  Targeted branch  master (currently at 334020a800)



If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).

---
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] Allow postinst functions to be verbose
  2017-04-14  2:39 [PATCH 0/2] Allow postinst functions to be verbose Peter Kjellerstedt
                   ` (2 preceding siblings ...)
  2017-04-14  3:01 ` ✗ patchtest: failure for Allow postinst functions to be verbose Patchwork
@ 2017-04-14  8:49 ` Richard Purdie
  2017-04-14 13:10   ` Peter Kjellerstedt
  3 siblings, 1 reply; 7+ messages in thread
From: Richard Purdie @ 2017-04-14  8:49 UTC (permalink / raw)
  To: Peter Kjellerstedt, openembedded-core

On Fri, 2017-04-14 at 04:39 +0200, Peter Kjellerstedt wrote:
> This enables tracing of the postinst functions created in base-passwd
> and useradd.bbclass if BB_VERBOSE_LOGS is enabled. I found this
> extremely useful during verification of the useradd functionality,
> especially as there otherwise is absolutely nothing in the logs of
> why
> a failure in a postinst function happened.
> 
> I also simplified useradd_sysroot_sstate() by only having the code to
> create the postinst files once.
> 
> Feel free to squash these commits with the "base-passwd/useradd:
> Various improvements to useradd with RSS" commit if you prefer.

I'm afraid I can't take these since these scripts get written into the
sstate objects for the recipes in question and this would make the
sstate change depending on the parameters you call bitbake with. I
think we'd both agree that is undesirable.

Not sure what we can do but this needs more thought.

Cheers,

Richard






^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] Allow postinst functions to be verbose
  2017-04-14  8:49 ` [PATCH 0/2] " Richard Purdie
@ 2017-04-14 13:10   ` Peter Kjellerstedt
  2017-04-18 10:16     ` Alexander Kanavin
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Kjellerstedt @ 2017-04-14 13:10 UTC (permalink / raw)
  To: Richard Purdie, openembedded-core

> -----Original Message-----
> From: Richard Purdie [mailto:richard.purdie@linuxfoundation.org]
> Sent: den 14 april 2017 10:49
> To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>; openembedded-
> core@lists.openembedded.org
> Subject: Re: [OE-core] [PATCH 0/2] Allow postinst functions to be
> verbose
> 
> On Fri, 2017-04-14 at 04:39 +0200, Peter Kjellerstedt wrote:
> > This enables tracing of the postinst functions created in base-passwd
> > and useradd.bbclass if BB_VERBOSE_LOGS is enabled. I found this
> > extremely useful during verification of the useradd functionality,
> > especially as there otherwise is absolutely nothing in the logs of
> > why
> > a failure in a postinst function happened.
> >
> > I also simplified useradd_sysroot_sstate() by only having the code to
> > create the postinst files once.
> >
> > Feel free to squash these commits with the "base-passwd/useradd:
> > Various improvements to useradd with RSS" commit if you prefer.
> 
> I'm afraid I can't take these since these scripts get written into the
> sstate objects for the recipes in question and this would make the
> sstate change depending on the parameters you call bitbake with. I
> think we'd both agree that is undesirable.

Bother. Did not think of that (I am so used to having it enabled in all my 
builds).

> Not sure what we can do but this needs more thought.

Yeah, it would be great if the output from the postinst scripts was actually
captured. But we can think of that for 2.4.

> Cheers,
> 
> Richard

//Peter

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] Allow postinst functions to be verbose
  2017-04-14 13:10   ` Peter Kjellerstedt
@ 2017-04-18 10:16     ` Alexander Kanavin
  0 siblings, 0 replies; 7+ messages in thread
From: Alexander Kanavin @ 2017-04-18 10:16 UTC (permalink / raw)
  To: openembedded-core, peter.kjellerstedt

On 04/14/2017 04:10 PM, Peter Kjellerstedt wrote:
>> I'm afraid I can't take these since these scripts get written into the
>> sstate objects for the recipes in question and this would make the
>> sstate change depending on the parameters you call bitbake with. I
>> think we'd both agree that is undesirable.
>
> Bother. Did not think of that (I am so used to having it enabled in all my
> builds).
>
>> Not sure what we can do but this needs more thought.
>
> Yeah, it would be great if the output from the postinst scripts was actually
> captured. But we can think of that for 2.4.

Are you using rpm? If you are, we already have ROOTFS_RPM_DEBUG variable 
which, if enabled, directs rpm to output a lot more to the log.do_rootfs 
than it normally would. Can you switch it on in your local.conf and see 
if you get what you need?

If the log still isn't verbose enough, please write a comment to this bug:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=11096

explaining what kind of output from rpm would be useful to have, and we 
can patch rpm to do that.


Alex


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-04-18 10:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-14  2:39 [PATCH 0/2] Allow postinst functions to be verbose Peter Kjellerstedt
2017-04-14  2:39 ` [PATCH 1/2] useradd.bbclass: Make postinst functions verbose if BB_VERBOSE_LOGS is set Peter Kjellerstedt
2017-04-14  2:39 ` [PATCH 2/2] base-passwd: Make the postinst function " Peter Kjellerstedt
2017-04-14  3:01 ` ✗ patchtest: failure for Allow postinst functions to be verbose Patchwork
2017-04-14  8:49 ` [PATCH 0/2] " Richard Purdie
2017-04-14 13:10   ` Peter Kjellerstedt
2017-04-18 10:16     ` Alexander Kanavin

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.