summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorLinus Wallgren <linus.wallgren@scypho.com>2016-11-14 17:20:13 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-04-05 15:13:47 +0100
commit2d5e8043be1305c633bd44652bf1c34950214a9e (patch)
tree0bfe3c9af94ef917ab0b1a0288fad8847d104bb2 /meta
parent8d9783464a7e7e366404b779f44cafbdc3d38a4c (diff)
downloadpoky-2d5e8043be1305c633bd44652bf1c34950214a9e.tar.gz
lib/oe/package_manager: .deb pre/postinst args
The debian policy manual and MaintainerScripts wiki page states that the postinst script is supposed to be called with the `configure` argument at first install, likewise the preinst script is supposed to be called with the `install` argument on first install. https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html https://wiki.debian.org/MaintainerScripts (From OE-Core rev: 3d9c3aae54589794ce3484fa1b21d1af2bd32661) (From OE-Core rev: ba59b6416f24ad53f1caccf9185b46cb60da213a) Signed-off-by: Linus Wallgren <linus.wallgren@scypho.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oe/package_manager.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 13577b18bd..7c280ae0a7 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -2000,7 +2000,10 @@ class DpkgPM(OpkgDpkgPM):
2000 """ 2000 """
2001 def run_pre_post_installs(self, package_name=None): 2001 def run_pre_post_installs(self, package_name=None):
2002 info_dir = self.target_rootfs + "/var/lib/dpkg/info" 2002 info_dir = self.target_rootfs + "/var/lib/dpkg/info"
2003 suffixes = [(".preinst", "Preinstall"), (".postinst", "Postinstall")] 2003 ControlScript = collections.namedtuple("ControlScript", ["suffix", "name", "argument"])
2004 control_scripts = [
2005 ControlScript(".preinst", "Preinstall", "install"),
2006 ControlScript(".postinst", "Postinstall", "configure")]
2004 status_file = self.target_rootfs + "/var/lib/dpkg/status" 2007 status_file = self.target_rootfs + "/var/lib/dpkg/status"
2005 installed_pkgs = [] 2008 installed_pkgs = []
2006 2009
@@ -2023,16 +2026,18 @@ class DpkgPM(OpkgDpkgPM):
2023 2026
2024 failed_pkgs = [] 2027 failed_pkgs = []
2025 for pkg_name in installed_pkgs: 2028 for pkg_name in installed_pkgs:
2026 for suffix in suffixes: 2029 for control_script in control_scripts:
2027 p_full = os.path.join(info_dir, pkg_name + suffix[0]) 2030 p_full = os.path.join(info_dir, pkg_name + control_script.suffix)
2028 if os.path.exists(p_full): 2031 if os.path.exists(p_full):
2029 try: 2032 try:
2030 bb.note("Executing %s for package: %s ..." % 2033 bb.note("Executing %s for package: %s ..." %
2031 (suffix[1].lower(), pkg_name)) 2034 (control_script.name.lower(), pkg_name))
2032 subprocess.check_output(p_full, stderr=subprocess.STDOUT) 2035 subprocess.check_output([p_full, control_script.argument],
2036 stderr=subprocess.STDOUT)
2033 except subprocess.CalledProcessError as e: 2037 except subprocess.CalledProcessError as e:
2034 bb.note("%s for package %s failed with %d:\n%s" % 2038 bb.note("%s for package %s failed with %d:\n%s" %
2035 (suffix[1], pkg_name, e.returncode, e.output.decode("utf-8"))) 2039 (control_script.name, pkg_name, e.returncode,
2040 e.output.decode("utf-8")))
2036 failed_pkgs.append(pkg_name) 2041 failed_pkgs.append(pkg_name)
2037 break 2042 break
2038 2043