All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Kanavin <alexander.kanavin@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 5/7] meta/lib/oe/package_manager.py: deprecate 'exit 1' as a way to defer to first boot
Date: Mon, 29 Jan 2018 14:01:32 +0200	[thread overview]
Message-ID: <e2a78fad445b727ba649e5fecb0832ab7494c6db.1517227178.git.alexander.kanavin@linux.intel.com> (raw)
In-Reply-To: <cover.1517227178.git.alexander.kanavin@linux.intel.com>

'exit 1' is not optimal for two reasons:

1) Code is hard to read; it is not obvious that it means 'defer what follows to first boot'.
2) Worse, this hides actual errors in the scriptlets; there is no difference between scriptlet
failing because it's intended to be run on target and scriptlet failing because there's a bug or
a regression somewhere.

The new, supported way is to place the code that has to run on target into pkg_postinst_ontarget(),
or, if a more fine-tuned control is required, call 'postinst-intercepts defer_to_first_boot' from
pkg_postinst() to explicitly request deferral to first boot.

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
---
 meta/lib/oe/package_manager.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 2a07f0e39ad..f7e013437c9 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -604,6 +604,9 @@ class RpmPM(PackageManager):
             if line.startswith("Non-fatal POSTIN scriptlet failure in rpm package"):
                 failed_scriptlets_pkgnames[line.split()[-1]] = True
 
+        if len(failed_scriptlets_pkgnames) > 0:
+            bb.warn("Intentionally failing postinstall scriptlets of %s to defer them to first boot is deprecated. Please place them into pkg_postinst_ontarget_${PN} ()." %(list(failed_scriptlets_pkgnames.keys())))
+            bb.warn("If deferring to first boot wasn't the intent, then scriptlet failure may mean an issue in the recipe, or a regression elsewhere.")
         for pkg in failed_scriptlets_pkgnames.keys():
             self.save_rpmpostinst(pkg)
 
-- 
2.15.1



  parent reply	other threads:[~2018-01-29 12:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-29 12:01 [PATCH 0/7] Fix first boot deferral and postinst error reporting Alexander Kanavin
2018-01-29 12:01 ` [PATCH 1/7] postinst_intercepts: add a delay_to_first_boot hook Alexander Kanavin
2018-01-29 12:01 ` [PATCH 2/7] meta/lib/oe/rootfs.py: separate first boot deferral logic into a separate function Alexander Kanavin
2018-01-29 12:01 ` [PATCH 3/7] meta/lib/oe/rootfs.py: do not execute defer_to_first_boot when processing postinst_intercept hooks Alexander Kanavin
2018-01-29 12:01 ` [PATCH 4/7] package.bbclass: add support for pkg_postinst_ontarget() Alexander Kanavin
2018-01-29 12:01 ` Alexander Kanavin [this message]
2018-01-29 12:01 ` [PATCH 6/7] package_rpm.bbclass: run pre/post installation scriptlets using sh -e Alexander Kanavin
2018-01-29 12:01 ` [PATCH 7/7] rootfs.py: change the notice about deferring scripts to first boot from warning to a note Alexander Kanavin
2018-01-29 12:14 ` [PATCH 0/7] Fix first boot deferral and postinst error reporting Diaz de Grenu, Jose
2018-01-29 12:34 ` ✗ patchtest: failure for " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e2a78fad445b727ba649e5fecb0832ab7494c6db.1517227178.git.alexander.kanavin@linux.intel.com \
    --to=alexander.kanavin@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.