summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/package_manager.py
diff options
context:
space:
mode:
authorAlexander Kanavin <alexander.kanavin@linux.intel.com>2018-08-28 16:43:59 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-09-04 11:03:55 +0100
commit5e3a07180b7357c780b76a1feec1785b33603aeb (patch)
tree57233895df7e11f199326727503ae7d6a939b48a /meta/lib/oe/package_manager.py
parent4434777705cf49300a7d2c9ca8fa3080d551d795 (diff)
downloadpoky-5e3a07180b7357c780b76a1feec1785b33603aeb.tar.gz
lib/oe/package_manager: turn postinst failure warnings into bitbake failures
Sumo release provides a transition period so that deferrals to first boot via 'exit 1' can be converted to pkg_postinst_ontarget(). For the next release however, postinst script failures should be treated as such. [YOCTO #12607] (From OE-Core rev: 42acb0ebde4e88bcdf34a541b700f19d8607abb0) Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/package_manager.py')
-rw-r--r--meta/lib/oe/package_manager.py22
1 files changed, 7 insertions, 15 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 398838835e..a17de5de73 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -84,10 +84,10 @@ def opkg_query(cmd_output):
84 84
85 return output 85 return output
86 86
87# Note: this should be bb.fatal in the future. 87def failed_postinsts_abort(pkgs, log_path):
88def failed_postinsts_warn(pkgs, log_path): 88 bb.fatal("""Postinstall scriptlets of %s have failed. If the intention is to defer them to first boot,
89 bb.warn("""Intentionally failing postinstall scriptlets of %s to defer them to first boot is deprecated. Please place them into pkg_postinst_ontarget_${PN} (). 89then please place them into pkg_postinst_ontarget_${PN} ().
90If deferring to first boot wasn't the intent, then scriptlet failure may mean an issue in the recipe, or a regression elsewhere. 90Deferring to first boot via 'exit 1' is no longer supported.
91Details of the failure are in %s.""" %(pkgs, log_path)) 91Details of the failure are in %s.""" %(pkgs, log_path))
92 92
93def generate_locale_archive(d, rootfs, target_arch, localedir): 93def generate_locale_archive(d, rootfs, target_arch, localedir):
@@ -858,9 +858,7 @@ class RpmPM(PackageManager):
858 failed_scriptlets_pkgnames[line.split()[-1]] = True 858 failed_scriptlets_pkgnames[line.split()[-1]] = True
859 859
860 if len(failed_scriptlets_pkgnames) > 0: 860 if len(failed_scriptlets_pkgnames) > 0:
861 failed_postinsts_warn(list(failed_scriptlets_pkgnames.keys()), self.d.expand("${T}/log.do_${BB_CURRENTTASK}")) 861 failed_postinsts_abort(list(failed_scriptlets_pkgnames.keys()), self.d.expand("${T}/log.do_${BB_CURRENTTASK}"))
862 for pkg in failed_scriptlets_pkgnames.keys():
863 self.save_rpmpostinst(pkg)
864 862
865 def remove(self, pkgs, with_dependencies = True): 863 def remove(self, pkgs, with_dependencies = True):
866 if len(pkgs) == 0: 864 if len(pkgs) == 0:
@@ -1341,7 +1339,7 @@ class OpkgPM(OpkgDpkgPM):
1341 bb.warn(line) 1339 bb.warn(line)
1342 failed_pkgs.append(line.split(".")[0]) 1340 failed_pkgs.append(line.split(".")[0])
1343 if failed_pkgs: 1341 if failed_pkgs:
1344 failed_postinsts_warn(failed_pkgs, self.d.expand("${T}/log.do_${BB_CURRENTTASK}")) 1342 failed_postinsts_abort(failed_pkgs, self.d.expand("${T}/log.do_${BB_CURRENTTASK}"))
1345 except subprocess.CalledProcessError as e: 1343 except subprocess.CalledProcessError as e:
1346 (bb.fatal, bb.warn)[attempt_only]("Unable to install packages. " 1344 (bb.fatal, bb.warn)[attempt_only]("Unable to install packages. "
1347 "Command '%s' returned %d:\n%s" % 1345 "Command '%s' returned %d:\n%s" %
@@ -1594,7 +1592,6 @@ class DpkgPM(OpkgDpkgPM):
1594 os.environ['INTERCEPT_DIR'] = self.intercepts_dir 1592 os.environ['INTERCEPT_DIR'] = self.intercepts_dir
1595 os.environ['NATIVE_ROOT'] = self.d.getVar('STAGING_DIR_NATIVE') 1593 os.environ['NATIVE_ROOT'] = self.d.getVar('STAGING_DIR_NATIVE')
1596 1594
1597 failed_pkgs = []
1598 for pkg_name in installed_pkgs: 1595 for pkg_name in installed_pkgs:
1599 for control_script in control_scripts: 1596 for control_script in control_scripts:
1600 p_full = os.path.join(info_dir, pkg_name + control_script.suffix) 1597 p_full = os.path.join(info_dir, pkg_name + control_script.suffix)
@@ -1609,12 +1606,7 @@ class DpkgPM(OpkgDpkgPM):
1609 bb.warn("%s for package %s failed with %d:\n%s" % 1606 bb.warn("%s for package %s failed with %d:\n%s" %
1610 (control_script.name, pkg_name, e.returncode, 1607 (control_script.name, pkg_name, e.returncode,
1611 e.output.decode("utf-8"))) 1608 e.output.decode("utf-8")))
1612 failed_postinsts_warn([pkg_name], self.d.expand("${T}/log.do_${BB_CURRENTTASK}")) 1609 failed_postinsts_abort([pkg_name], self.d.expand("${T}/log.do_${BB_CURRENTTASK}"))
1613 failed_pkgs.append(pkg_name)
1614 break
1615
1616 if len(failed_pkgs):
1617 self.mark_packages("unpacked", failed_pkgs)
1618 1610
1619 def update(self): 1611 def update(self):
1620 os.environ['APT_CONFIG'] = self.apt_conf_file 1612 os.environ['APT_CONFIG'] = self.apt_conf_file