summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorAlexander Kanavin <alexander.kanavin@linux.intel.com>2018-03-12 18:49:42 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-03-15 06:27:18 -0700
commitcd005e2d5bab8bc7cf4fd8b66c0bcc0328a0decd (patch)
tree55827bfeb8fb6f5b7079eb06b501eb55ea26ff3f /meta/lib
parentc64a57d2ecad041e2eea7bde46aab8269b31fc15 (diff)
downloadpoky-cd005e2d5bab8bc7cf4fd8b66c0bcc0328a0decd.tar.gz
meta/lib/oe/package_manager.py: warn about failing scriptlets for all package types
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. (From OE-Core rev: a36671faf6e0b7623185b0e22814a786d5444592) Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/package_manager.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index c10efb8df4..0c5cf3cf7f 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -83,6 +83,11 @@ def opkg_query(cmd_output):
83 83
84 return output 84 return output
85 85
86# Note: this should be bb.fatal in the future.
87def failed_postinsts_warn(pkgs, log_path):
88 bb.warn("""Intentionally failing postinstall scriptlets of %s to defer them to first boot is deprecated. Please place them into pkg_postinst_ontarget_${PN} ().
89If deferring to first boot wasn't the intent, then scriptlet failure may mean an issue in the recipe, or a regression elsewhere.
90Details of the failure are in %s.""" %(pkgs, log_path))
86 91
87class Indexer(object, metaclass=ABCMeta): 92class Indexer(object, metaclass=ABCMeta):
88 def __init__(self, d, deploy_dir): 93 def __init__(self, d, deploy_dir):
@@ -709,8 +714,7 @@ class RpmPM(PackageManager):
709 failed_scriptlets_pkgnames[line.split()[-1]] = True 714 failed_scriptlets_pkgnames[line.split()[-1]] = True
710 715
711 if len(failed_scriptlets_pkgnames) > 0: 716 if len(failed_scriptlets_pkgnames) > 0:
712 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()))) 717 failed_postinsts_warn(list(failed_scriptlets_pkgnames.keys()), self.d.expand("${T}/log.do_rootfs"))
713 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.")
714 for pkg in failed_scriptlets_pkgnames.keys(): 718 for pkg in failed_scriptlets_pkgnames.keys():
715 self.save_rpmpostinst(pkg) 719 self.save_rpmpostinst(pkg)
716 720
@@ -1172,6 +1176,13 @@ class OpkgPM(OpkgDpkgPM):
1172 bb.note(cmd) 1176 bb.note(cmd)
1173 output = subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT).decode("utf-8") 1177 output = subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT).decode("utf-8")
1174 bb.note(output) 1178 bb.note(output)
1179 failed_pkgs = []
1180 for line in output.split('\n'):
1181 if line.endswith("configuration required on target."):
1182 bb.warn(line)
1183 failed_pkgs.append(line.split(".")[0])
1184 if failed_pkgs:
1185 failed_postinsts_warn(failed_pkgs, self.d.expand("${T}/log.do_rootfs"))
1175 except subprocess.CalledProcessError as e: 1186 except subprocess.CalledProcessError as e:
1176 (bb.fatal, bb.warn)[attempt_only]("Unable to install packages. " 1187 (bb.fatal, bb.warn)[attempt_only]("Unable to install packages. "
1177 "Command '%s' returned %d:\n%s" % 1188 "Command '%s' returned %d:\n%s" %
@@ -1435,9 +1446,10 @@ class DpkgPM(OpkgDpkgPM):
1435 stderr=subprocess.STDOUT).decode("utf-8") 1446 stderr=subprocess.STDOUT).decode("utf-8")
1436 bb.note(output) 1447 bb.note(output)
1437 except subprocess.CalledProcessError as e: 1448 except subprocess.CalledProcessError as e:
1438 bb.note("%s for package %s failed with %d:\n%s" % 1449 bb.warn("%s for package %s failed with %d:\n%s" %
1439 (control_script.name, pkg_name, e.returncode, 1450 (control_script.name, pkg_name, e.returncode,
1440 e.output.decode("utf-8"))) 1451 e.output.decode("utf-8")))
1452 failed_postinsts_warn([pkg_name], self.d.expand("${T}/log.do_rootfs"))
1441 failed_pkgs.append(pkg_name) 1453 failed_pkgs.append(pkg_name)
1442 break 1454 break
1443 1455