summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe
diff options
context:
space:
mode:
authorLinus Wallgren <linus.wallgren@scypho.com>2016-11-14 17:20:13 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-11-23 11:10:11 +0000
commitb91e47fccb622a2c3a545848b10defc1aee104ac (patch)
tree063d259720a184db8e18a2ab6641bf6a9cbe3027 /meta/lib/oe
parentcd381cd71466158b34160fc0519db9f1c5870af4 (diff)
downloadpoky-b91e47fccb622a2c3a545848b10defc1aee104ac.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) 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>
Diffstat (limited to 'meta/lib/oe')
-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 a9d216a88e..7ba2e4d332 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -1993,7 +1993,10 @@ class DpkgPM(OpkgDpkgPM):
1993 """ 1993 """
1994 def run_pre_post_installs(self, package_name=None): 1994 def run_pre_post_installs(self, package_name=None):
1995 info_dir = self.target_rootfs + "/var/lib/dpkg/info" 1995 info_dir = self.target_rootfs + "/var/lib/dpkg/info"
1996 suffixes = [(".preinst", "Preinstall"), (".postinst", "Postinstall")] 1996 ControlScript = collections.namedtuple("ControlScript", ["suffix", "name", "argument"])
1997 control_scripts = [
1998 ControlScript(".preinst", "Preinstall", "install"),
1999 ControlScript(".postinst", "Postinstall", "configure")]
1997 status_file = self.target_rootfs + "/var/lib/dpkg/status" 2000 status_file = self.target_rootfs + "/var/lib/dpkg/status"
1998 installed_pkgs = [] 2001 installed_pkgs = []
1999 2002
@@ -2016,16 +2019,18 @@ class DpkgPM(OpkgDpkgPM):
2016 2019
2017 failed_pkgs = [] 2020 failed_pkgs = []
2018 for pkg_name in installed_pkgs: 2021 for pkg_name in installed_pkgs:
2019 for suffix in suffixes: 2022 for control_script in control_scripts:
2020 p_full = os.path.join(info_dir, pkg_name + suffix[0]) 2023 p_full = os.path.join(info_dir, pkg_name + control_script.suffix)
2021 if os.path.exists(p_full): 2024 if os.path.exists(p_full):
2022 try: 2025 try:
2023 bb.note("Executing %s for package: %s ..." % 2026 bb.note("Executing %s for package: %s ..." %
2024 (suffix[1].lower(), pkg_name)) 2027 (control_script.name.lower(), pkg_name))
2025 subprocess.check_output(p_full, stderr=subprocess.STDOUT) 2028 subprocess.check_output([p_full, control_script.argument],
2029 stderr=subprocess.STDOUT)
2026 except subprocess.CalledProcessError as e: 2030 except subprocess.CalledProcessError as e:
2027 bb.note("%s for package %s failed with %d:\n%s" % 2031 bb.note("%s for package %s failed with %d:\n%s" %
2028 (suffix[1], pkg_name, e.returncode, e.output.decode("utf-8"))) 2032 (control_script.name, pkg_name, e.returncode,
2033 e.output.decode("utf-8")))
2029 failed_pkgs.append(pkg_name) 2034 failed_pkgs.append(pkg_name)
2030 break 2035 break
2031 2036