Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Alexander Kanavin <alexander.kanavin@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 02/15] meta/lib/oe/package_manager.py: warn about failing scriptlets for all package types
Date: Thu,  1 Mar 2018 16:00:39 +0200	[thread overview]
Message-ID: <20180301140052.1388-2-alexander.kanavin@linux.intel.com> (raw)
In-Reply-To: <20180301140052.1388-1-alexander.kanavin@linux.intel.com>

Previously this was done only for rpm packages; now also ipk/deb scriptlet
failures are reported.

In the future this will become a hard error, but it can't yet happen
due to the legacy 'exit 1' way of deferring scriptlet execution to first boot which
needs a deprecation period.

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

diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index f7e013437c9..1ae31f8e744 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -83,6 +83,11 @@ def opkg_query(cmd_output):
 
     return output
 
+# Note: this should be bb.fatal in the future.
+def failed_postinsts_warn(pkgs, log_path):
+    bb.warn("""Intentionally failing postinstall scriptlets of %s to defer them to first boot is deprecated. Please place them into pkg_postinst_ontarget_${PN} ().
+If deferring to first boot wasn't the intent, then scriptlet failure may mean an issue in the recipe, or a regression elsewhere.
+Details of the failure are in %s.""" %(pkgs, log_path))
 
 class Indexer(object, metaclass=ABCMeta):
     def __init__(self, d, deploy_dir):
@@ -605,8 +610,7 @@ class RpmPM(PackageManager):
                 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.")
+            failed_postinsts_warn(list(failed_scriptlets_pkgnames.keys()), self.d.expand("${T}/log.do_rootfs"))
         for pkg in failed_scriptlets_pkgnames.keys():
             self.save_rpmpostinst(pkg)
 
@@ -1068,6 +1072,13 @@ class OpkgPM(OpkgDpkgPM):
             bb.note(cmd)
             output = subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT).decode("utf-8")
             bb.note(output)
+            failed_pkgs = []
+            for line in output.split('\n'):
+                if line.endswith("configuration required on target."):
+                    bb.warn(line)
+                    failed_pkgs.append(line.split(".")[0])
+            if failed_pkgs:
+                failed_postinsts_warn(failed_pkgs, self.d.expand("${T}/log.do_rootfs"))
         except subprocess.CalledProcessError as e:
             (bb.fatal, bb.note)[attempt_only]("Unable to install packages. "
                                               "Command '%s' returned %d:\n%s" %
@@ -1331,9 +1342,10 @@ class DpkgPM(OpkgDpkgPM):
                                 stderr=subprocess.STDOUT).decode("utf-8")
                         bb.note(output)
                     except subprocess.CalledProcessError as e:
-                        bb.note("%s for package %s failed with %d:\n%s" %
+                        bb.warn("%s for package %s failed with %d:\n%s" %
                                 (control_script.name, pkg_name, e.returncode,
                                     e.output.decode("utf-8")))
+                        failed_postinsts_warn([pkg_name], self.d.expand("${T}/log.do_rootfs"))
                         failed_pkgs.append(pkg_name)
                         break
 
-- 
2.15.1



  reply	other threads:[~2018-03-01 14:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-01 14:00 [PATCH 01/15] package.bbclass: run pre/post installation/removal scriptlets using sh -e Alexander Kanavin
2018-03-01 14:00 ` Alexander Kanavin [this message]
2018-03-01 14:00 ` [PATCH 03/15] oe-selftest: add a test for failing package post-installation scriptlets Alexander Kanavin
2018-03-01 14:00 ` [PATCH 04/15] latencytop: remove recipe Alexander Kanavin
2018-03-01 14:00 ` [PATCH 05/15] lsbinitscripts: update to 9.79 Alexander Kanavin
2018-03-01 14:00 ` [PATCH 06/15] btrfs-tools: update to 4.15.1 Alexander Kanavin
2018-03-01 14:00 ` [PATCH 07/15] gtk-doc.bbclass: inherit python3native Alexander Kanavin
2018-03-01 23:34   ` Burton, Ross
2018-03-02  8:55     ` Alexander Kanavin
2018-03-01 14:00 ` [PATCH 08/15] strace: use strace.io as the tarball location Alexander Kanavin
2018-03-01 14:00 ` [PATCH 09/15] mpg123: upgrade 1.25.8 -> 1.25.10 Alexander Kanavin
2018-03-01 14:00 ` [PATCH 10/15] ffmpeg: upgrade 3.4.1 -> 3.4.2 Alexander Kanavin
2018-03-01 14:00 ` [PATCH 11/15] epiphany: upgrade 3.26.5.1 -> 3.26.6 Alexander Kanavin
2018-03-01 14:00 ` [PATCH 12/15] vala: upgrade 0.38.6 -> 0.38.8 Alexander Kanavin
2018-03-01 14:00 ` [PATCH 13/15] meson: upgrade 0.44.0 -> 0.44.1 Alexander Kanavin
2018-03-01 14:00 ` [PATCH 14/15] expect: upgrade 5.45.3 -> 5.45.4 Alexander Kanavin
2018-03-02 14:12   ` Burton, Ross
2018-03-02 18:14     ` Denys Dmytriyenko
2018-03-02 20:56       ` Burton, Ross
2018-03-02 22:40       ` Richard Purdie
2018-03-01 14:00 ` [PATCH 15/15] trace-cmd: update to 2.7 Alexander Kanavin

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=20180301140052.1388-2-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox