All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/8] nativesdk-postinst-intercept: remove the recipe
@ 2018-04-03 15:45 Alexander Kanavin
  2018-04-03 15:45 ` [PATCH 2/8] package_manager.py: move target_rootfs property to common ancestor class Alexander Kanavin
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Alexander Kanavin @ 2018-04-03 15:45 UTC (permalink / raw)
  To: openembedded-core

Its use required a script from an external repo which hasn't been updated
in 4 years, the recipe itself is out of date (doesn't install all
intercepts), and there is no oe-selftest or documentation for this.
If anyone still wants this, please do it in a separate layer.

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
---
 meta/conf/distro/include/distro_alias.inc              |  1 -
 meta/conf/distro/include/maintainers.inc               |  1 -
 .../packagegroups/nativesdk-packagegroup-sdk-host.bb   |  1 -
 .../nativesdk-postinst-intercept_1.0.bb                | 18 ------------------
 4 files changed, 21 deletions(-)
 delete mode 100644 meta/recipes-devtools/postinst-intercept/nativesdk-postinst-intercept_1.0.bb

diff --git a/meta/conf/distro/include/distro_alias.inc b/meta/conf/distro/include/distro_alias.inc
index 8ec623befbd..13c7e652bc7 100644
--- a/meta/conf/distro/include/distro_alias.inc
+++ b/meta/conf/distro/include/distro_alias.inc
@@ -313,7 +313,6 @@ DISTRO_PN_ALIAS_pn-pkgconfig = "Ubuntu=pkg-config Fedora=pkgconfig"
 DISTRO_PN_ALIAS_pn-pointercal-xinput = "OE-Core"
 DISTRO_PN_ALIAS_pn-pong-clock = "OpenedHand"
 DISTRO_PN_ALIAS_pn-portmap = "Debian=rpcbind Fedora=rpcbind"
-DISTRO_PN_ALIAS_pn-postinst-intercept = "OE-Core"
 DISTRO_PN_ALIAS_pn-powertop = "Meego=powertop Fedora=powertop Debian=powertop OpenSuSE=powertop Mandriva=powertop"
 DISTRO_PN_ALIAS_pn-ppp-dialin = "OE-Core"
 DISTRO_PN_ALIAS_pn-presentproto = "Debian=x11proto-present-dev Fedora=xorg-x11-proto-devel"
diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc
index e471891f2ce..48aff9537e4 100644
--- a/meta/conf/distro/include/maintainers.inc
+++ b/meta/conf/distro/include/maintainers.inc
@@ -527,7 +527,6 @@ RECIPE_MAINTAINER_pn-nativesdk-buildtools-perl-dummy = "Richard Purdie <richard.
 RECIPE_MAINTAINER_pn-nativesdk-libtool = "Richard Purdie <richard.purdie@linuxfoundation.org>"
 RECIPE_MAINTAINER_pn-nativesdk-packagegroup-sdk-host = "Ross Burton <ross.burton@intel.com>"
 RECIPE_MAINTAINER_pn-nativesdk-qemu-helper = "Juro Bystricky <juro.bystricky@intel.com>"
-RECIPE_MAINTAINER_pn-nativesdk-postinst-intercept = "Alexander Kanavin <alexander.kanavin@intel.com>"
 RECIPE_MAINTAINER_pn-ncurses = "Hongxu Jia <hongxu.jia@windriver.com>"
 RECIPE_MAINTAINER_pn-neard = "Maxin B. John <maxin.john@intel.com>"
 RECIPE_MAINTAINER_pn-neon = "Maxin B. John <maxin.john@intel.com>"
diff --git a/meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb b/meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb
index 88e7c648b64..e2f61699946 100644
--- a/meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb
+++ b/meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb
@@ -23,7 +23,6 @@ RDEPENDS_${PN} = "\
     nativesdk-makedevs \
     nativesdk-dnf \
     nativesdk-cmake \
-    nativesdk-postinst-intercept \
     ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'nativesdk-wayland', '', d)} \
     nativesdk-sdk-provides-dummy \
     "
diff --git a/meta/recipes-devtools/postinst-intercept/nativesdk-postinst-intercept_1.0.bb b/meta/recipes-devtools/postinst-intercept/nativesdk-postinst-intercept_1.0.bb
deleted file mode 100644
index 938ac8ad7b3..00000000000
--- a/meta/recipes-devtools/postinst-intercept/nativesdk-postinst-intercept_1.0.bb
+++ /dev/null
@@ -1,18 +0,0 @@
-SUMMARY = "Postinstall scriptlets"
-LICENSE = "MIT"
-
-FILES_${PN}_append = " ${datadir}/postinst-intercepts/*"
-
-do_configure[noexec] = "1"
-do_compile[noexec] = "1"
-
-do_install() {
-	install -d ${D}${datadir}/postinst-intercepts
-	install -m 755 ${COREBASE}/scripts/postinst-intercepts/postinst_intercept ${D}${datadir}/postinst-intercepts/
-	install -m 755 ${COREBASE}/scripts/postinst-intercepts/update_font_cache ${D}${datadir}/postinst-intercepts/
-	install -m 755 ${COREBASE}/scripts/postinst-intercepts/update_icon_cache ${D}${datadir}/postinst-intercepts/
-	install -m 755 ${COREBASE}/scripts/postinst-intercepts/update_pixbuf_cache ${D}${datadir}/postinst-intercepts/
-}
-
-inherit nativesdk
-INHIBIT_DEFAULT_DEPS = "1"
-- 
2.16.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/8] package_manager.py: move target_rootfs property to common ancestor class
  2018-04-03 15:45 [PATCH 1/8] nativesdk-postinst-intercept: remove the recipe Alexander Kanavin
@ 2018-04-03 15:45 ` Alexander Kanavin
  2018-04-03 15:45 ` [PATCH 3/8] package_manager.py: move postinst_intercept dir initialization from RootFS to PackageManager class Alexander Kanavin
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alexander Kanavin @ 2018-04-03 15:45 UTC (permalink / raw)
  To: openembedded-core

This will be useful when also moving postinst_intercept handling to
package manager class from rootfs class.

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

diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index e006dc6215d..e0a114c3325 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -326,8 +326,9 @@ class PackageManager(object, metaclass=ABCMeta):
     This is an abstract class. Do not instantiate this directly.
     """
 
-    def __init__(self, d):
+    def __init__(self, d, target_rootfs):
         self.d = d
+        self.target_rootfs = target_rootfs
         self.deploy_dir = None
         self.deploy_lock = None
 
@@ -585,8 +586,7 @@ class RpmPM(PackageManager):
                  os_var=None,
                  rpm_repo_workdir="oe-rootfs-repo",
                  filterbydependencies=True):
-        super(RpmPM, self).__init__(d)
-        self.target_rootfs = target_rootfs
+        super(RpmPM, self).__init__(d, target_rootfs)
         self.target_vendor = target_vendor
         self.task_name = task_name
         if arch_var == None:
@@ -919,11 +919,11 @@ class RpmPM(PackageManager):
 
 
 class OpkgDpkgPM(PackageManager):
-    def __init__(self, d):
+    def __init__(self, d, target_rootfs):
         """
         This is an abstract class. Do not instantiate this directly.
         """
-        super(OpkgDpkgPM, self).__init__(d)
+        super(OpkgDpkgPM, self).__init__(d, target_rootfs)
 
     def package_info(self, pkg, cmd):
         """
@@ -988,9 +988,8 @@ class OpkgDpkgPM(PackageManager):
 
 class OpkgPM(OpkgDpkgPM):
     def __init__(self, d, target_rootfs, config_file, archs, task_name='target'):
-        super(OpkgPM, self).__init__(d)
+        super(OpkgPM, self).__init__(d, target_rootfs)
 
-        self.target_rootfs = target_rootfs
         self.config_file = config_file
         self.pkg_archs = archs
         self.task_name = task_name
@@ -1367,8 +1366,7 @@ class OpkgPM(OpkgDpkgPM):
 
 class DpkgPM(OpkgDpkgPM):
     def __init__(self, d, target_rootfs, archs, base_archs, apt_conf_dir=None):
-        super(DpkgPM, self).__init__(d)
-        self.target_rootfs = target_rootfs
+        super(DpkgPM, self).__init__(d, target_rootfs)
         self.deploy_dir = self.d.getVar('DEPLOY_DIR_DEB')
         if apt_conf_dir is None:
             self.apt_conf_dir = self.d.expand("${APTCONF_TARGET}/apt")
-- 
2.16.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/8] package_manager.py: move postinst_intercept dir initialization from RootFS to PackageManager class
  2018-04-03 15:45 [PATCH 1/8] nativesdk-postinst-intercept: remove the recipe Alexander Kanavin
  2018-04-03 15:45 ` [PATCH 2/8] package_manager.py: move target_rootfs property to common ancestor class Alexander Kanavin
@ 2018-04-03 15:45 ` Alexander Kanavin
  2018-04-03 15:45 ` [PATCH 4/8] package_manager.py: move intercept running logic from rootfs class " Alexander Kanavin
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alexander Kanavin @ 2018-04-03 15:45 UTC (permalink / raw)
  To: openembedded-core

This will allow handling postinst_intercepts when populating SDKs (which
use PackageManager class directly, and do not utilize RootFS class).

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
---
 meta/lib/oe/package_manager.py | 25 +++++++++++++++++++------
 meta/lib/oe/rootfs.py          | 13 +------------
 2 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index e0a114c3325..5b52fc9e713 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -12,6 +12,7 @@ import oe.utils
 import oe.path
 import string
 from oe.gpg_sign import get_signer
+import hashlib
 
 # this can be used by all PM backends to create the index files in parallel
 def create_index(arg):
@@ -331,6 +332,21 @@ class PackageManager(object, metaclass=ABCMeta):
         self.target_rootfs = target_rootfs
         self.deploy_dir = None
         self.deploy_lock = None
+        self._initialize_intercepts()
+
+    def _initialize_intercepts(self):
+        bb.note("Initializing intercept dir for %s" % self.target_rootfs)
+        postinst_intercepts_dir = self.d.getVar("POSTINST_INTERCEPTS_DIR")
+        if not postinst_intercepts_dir:
+            postinst_intercepts_dir = self.d.expand("${COREBASE}/scripts/postinst-intercepts")
+        # As there might be more than one instance of PackageManager operating at the same time
+        # we need to isolate the intercept_scripts directories from each other,
+        # hence the ugly hash digest in dir name.
+        self.intercepts_dir = os.path.join(self.d.getVar('WORKDIR'),
+                                      "intercept_scripts-%s" %(hashlib.sha256(self.target_rootfs.encode()).hexdigest()) )
+
+        bb.utils.remove(self.intercepts_dir, True)
+        shutil.copytree(postinst_intercepts_dir, self.intercepts_dir)
 
     @abstractmethod
     def update(self):
@@ -699,8 +715,7 @@ class RpmPM(PackageManager):
         os.environ['OFFLINE_ROOT'] = self.target_rootfs
         os.environ['IPKG_OFFLINE_ROOT'] = self.target_rootfs
         os.environ['OPKG_OFFLINE_ROOT'] = self.target_rootfs
-        os.environ['INTERCEPT_DIR'] = oe.path.join(self.d.getVar('WORKDIR'),
-                                                   "intercept_scripts")
+        os.environ['INTERCEPT_DIR'] = self.intercepts_dir
         os.environ['NATIVE_ROOT'] = self.d.getVar('STAGING_DIR_NATIVE')
 
 
@@ -1178,8 +1193,7 @@ class OpkgPM(OpkgDpkgPM):
         os.environ['OFFLINE_ROOT'] = self.target_rootfs
         os.environ['IPKG_OFFLINE_ROOT'] = self.target_rootfs
         os.environ['OPKG_OFFLINE_ROOT'] = self.target_rootfs
-        os.environ['INTERCEPT_DIR'] = os.path.join(self.d.getVar('WORKDIR'),
-                                                   "intercept_scripts")
+        os.environ['INTERCEPT_DIR'] = self.intercepts_dir
         os.environ['NATIVE_ROOT'] = self.d.getVar('STAGING_DIR_NATIVE')
 
         try:
@@ -1440,8 +1454,7 @@ class DpkgPM(OpkgDpkgPM):
         os.environ['OFFLINE_ROOT'] = self.target_rootfs
         os.environ['IPKG_OFFLINE_ROOT'] = self.target_rootfs
         os.environ['OPKG_OFFLINE_ROOT'] = self.target_rootfs
-        os.environ['INTERCEPT_DIR'] = os.path.join(self.d.getVar('WORKDIR'),
-                                                   "intercept_scripts")
+        os.environ['INTERCEPT_DIR'] = self.intercepts_dir
         os.environ['NATIVE_ROOT'] = self.d.getVar('STAGING_DIR_NATIVE')
 
         failed_pkgs = []
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index bf2aea2b25a..600a685d68f 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -178,20 +178,10 @@ class Rootfs(object, metaclass=ABCMeta):
         post_process_cmds = self.d.getVar("ROOTFS_POSTPROCESS_COMMAND")
         rootfs_post_install_cmds = self.d.getVar('ROOTFS_POSTINSTALL_COMMAND')
 
-        postinst_intercepts_dir = self.d.getVar("POSTINST_INTERCEPTS_DIR")
-        if not postinst_intercepts_dir:
-            postinst_intercepts_dir = self.d.expand("${COREBASE}/scripts/postinst-intercepts")
-        intercepts_dir = os.path.join(self.d.getVar('WORKDIR'),
-                                      "intercept_scripts")
-
-        bb.utils.remove(intercepts_dir, True)
-
         bb.utils.mkdirhier(self.image_rootfs)
 
         bb.utils.mkdirhier(self.deploydir)
 
-        shutil.copytree(postinst_intercepts_dir, intercepts_dir)
-
         execute_pre_post_process(self.d, pre_process_cmds)
 
         if self.progress_reporter:
@@ -312,8 +302,7 @@ class Rootfs(object, metaclass=ABCMeta):
 
 
     def _run_intercepts(self):
-        intercepts_dir = os.path.join(self.d.getVar('WORKDIR'),
-                                      "intercept_scripts")
+        intercepts_dir = self.pm.intercepts_dir
 
         bb.note("Running intercept scripts:")
         os.environ['D'] = self.image_rootfs
-- 
2.16.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/8] package_manager.py: move intercept running logic from rootfs class to PackageManager class
  2018-04-03 15:45 [PATCH 1/8] nativesdk-postinst-intercept: remove the recipe Alexander Kanavin
  2018-04-03 15:45 ` [PATCH 2/8] package_manager.py: move target_rootfs property to common ancestor class Alexander Kanavin
  2018-04-03 15:45 ` [PATCH 3/8] package_manager.py: move postinst_intercept dir initialization from RootFS to PackageManager class Alexander Kanavin
@ 2018-04-03 15:45 ` Alexander Kanavin
  2018-04-03 15:45 ` [PATCH 5/8] package_manager.py: do not hardcode the task name when referring to log files Alexander Kanavin
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alexander Kanavin @ 2018-04-03 15:45 UTC (permalink / raw)
  To: openembedded-core

This allows running the intercepts when creating SDKs, which previously
wasn't possible, as SDK code does not use the rootfs class, and calls
into PackageManager methods directly.

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
---
 meta/lib/oe/package_manager.py | 58 ++++++++++++++++++++++++++++++++++++++
 meta/lib/oe/rootfs.py          | 64 +-----------------------------------------
 2 files changed, 59 insertions(+), 63 deletions(-)

diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 5b52fc9e713..6c85a6d2c78 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -348,6 +348,54 @@ class PackageManager(object, metaclass=ABCMeta):
         bb.utils.remove(self.intercepts_dir, True)
         shutil.copytree(postinst_intercepts_dir, self.intercepts_dir)
 
+    @abstractmethod
+    def _handle_intercept_failure(self, failed_script):
+        pass
+
+    def _postpone_to_first_boot(self, postinst_intercept_hook):
+        with open(postinst_intercept_hook) as intercept:
+            registered_pkgs = None
+            for line in intercept.read().split("\n"):
+                m = re.match("^##PKGS:(.*)", line)
+                if m is not None:
+                    registered_pkgs = m.group(1).strip()
+                    break
+
+            if registered_pkgs is not None:
+                bb.note("If an image is being built, the postinstalls for the following packages "
+                        "will be postponed for first boot: %s" %
+                        registered_pkgs)
+
+                # call the backend dependent handler
+                self._handle_intercept_failure(registered_pkgs)
+
+
+    def run_intercepts(self):
+        intercepts_dir = self.intercepts_dir
+
+        bb.note("Running intercept scripts:")
+        os.environ['D'] = self.target_rootfs
+        os.environ['STAGING_DIR_NATIVE'] = self.d.getVar('STAGING_DIR_NATIVE')
+        for script in os.listdir(intercepts_dir):
+            script_full = os.path.join(intercepts_dir, script)
+
+            if script == "postinst_intercept" or not os.access(script_full, os.X_OK):
+                continue
+
+            if script == "delay_to_first_boot":
+                self._postpone_to_first_boot(script_full)
+                continue
+
+            bb.note("> Executing %s intercept ..." % script)
+
+            try:
+                output = subprocess.check_output(script_full, stderr=subprocess.STDOUT)
+                if output: bb.note(output.decode("utf-8"))
+            except subprocess.CalledProcessError as e:
+                bb.warn("The postinstall intercept hook '%s' failed, details in log.do_rootfs" % script)
+                bb.note("Exit code %d. Output:\n%s" % (e.returncode, e.output.decode("utf-8")))
+                self._postpone_to_first_boot(script_full)
+
     @abstractmethod
     def update(self):
         """
@@ -897,6 +945,14 @@ class RpmPM(PackageManager):
         open(saved_script_name, 'w').write(output)
         os.chmod(saved_script_name, 0o755)
 
+    def _handle_intercept_failure(self, registered_pkgs):
+        rpm_postinsts_dir = self.target_rootfs + self.d.expand('${sysconfdir}/rpm-postinsts/')
+        bb.utils.mkdirhier(rpm_postinsts_dir)
+
+        # Save the package postinstalls in /etc/rpm-postinsts
+        for pkg in registered_pkgs.split():
+            self.save_rpmpostinst(pkg)
+
     def extract(self, pkg):
         output = self._invoke_dnf(["repoquery", "--queryformat", "%{location}", pkg])
         pkg_name = output.splitlines()[-1]
@@ -1000,6 +1056,8 @@ class OpkgDpkgPM(PackageManager):
 
         return tmp_dir
 
+    def _handle_intercept_failure(self, registered_pkgs):
+        self.mark_packages("unpacked", registered_pkgs.split())
 
 class OpkgPM(OpkgDpkgPM):
     def __init__(self, d, target_rootfs, config_file, archs, task_name='target'):
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index 600a685d68f..f8f717c0505 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -92,10 +92,6 @@ class Rootfs(object, metaclass=ABCMeta):
                 self.d.getVar('PACKAGE_FEED_ARCHS'))
 
 
-    @abstractmethod
-    def _handle_intercept_failure(self, failed_script):
-        pass
-
     """
     The _cleanup() method should be used to clean-up stuff that we don't really
     want to end up on target. For example, in the case of RPM, the DB locks.
@@ -197,7 +193,7 @@ class Rootfs(object, metaclass=ABCMeta):
 
         execute_pre_post_process(self.d, rootfs_post_install_cmds)
 
-        self._run_intercepts()
+        self.pm.run_intercepts()
 
         execute_pre_post_process(self.d, post_process_cmds)
 
@@ -283,50 +279,6 @@ class Rootfs(object, metaclass=ABCMeta):
             # Remove the package manager data files
             self.pm.remove_packaging_data()
 
-    def _postpone_to_first_boot(self, postinst_intercept_hook):
-        with open(postinst_intercept_hook) as intercept:
-            registered_pkgs = None
-            for line in intercept.read().split("\n"):
-                m = re.match("^##PKGS:(.*)", line)
-                if m is not None:
-                    registered_pkgs = m.group(1).strip()
-                    break
-
-            if registered_pkgs is not None:
-                bb.note("The postinstalls for the following packages "
-                        "will be postponed for first boot: %s" %
-                        registered_pkgs)
-
-                # call the backend dependent handler
-                self._handle_intercept_failure(registered_pkgs)
-
-
-    def _run_intercepts(self):
-        intercepts_dir = self.pm.intercepts_dir
-
-        bb.note("Running intercept scripts:")
-        os.environ['D'] = self.image_rootfs
-        os.environ['STAGING_DIR_NATIVE'] = self.d.getVar('STAGING_DIR_NATIVE')
-        for script in os.listdir(intercepts_dir):
-            script_full = os.path.join(intercepts_dir, script)
-
-            if script == "postinst_intercept" or not os.access(script_full, os.X_OK):
-                continue
-
-            if script == "delay_to_first_boot":
-                self._postpone_to_first_boot(script_full)
-                continue
-
-            bb.note("> Executing %s intercept ..." % script)
-
-            try:
-                output = subprocess.check_output(script_full, stderr=subprocess.STDOUT)
-                if output: bb.note(output.decode("utf-8"))
-            except subprocess.CalledProcessError as e:
-                bb.warn("The postinstall intercept hook '%s' failed, details in log.do_rootfs" % script)
-                bb.note("Exit code %d. Output:\n%s" % (e.returncode, e.output.decode("utf-8")))
-                self._postpone_to_first_boot(script_full)
-
     def _run_ldconfig(self):
         if self.d.getVar('LDCONFIGDEPEND'):
             bb.note("Executing: ldconfig -r" + self.image_rootfs + "-c new -v")
@@ -519,14 +471,6 @@ class RpmRootfs(Rootfs):
         self._log_check_warn()
         self._log_check_error()
 
-    def _handle_intercept_failure(self, registered_pkgs):
-        rpm_postinsts_dir = self.image_rootfs + self.d.expand('${sysconfdir}/rpm-postinsts/')
-        bb.utils.mkdirhier(rpm_postinsts_dir)
-
-        # Save the package postinstalls in /etc/rpm-postinsts
-        for pkg in registered_pkgs.split():
-            self.pm.save_rpmpostinst(pkg)
-
     def _cleanup(self):
         self.pm._invoke_dnf(["clean", "all"])
 
@@ -707,9 +651,6 @@ class DpkgRootfs(DpkgOpkgRootfs):
         src_postinst_dir = self.d.expand("${IMAGE_ROOTFS}/var/lib/dpkg/info")
         return self._save_postinsts_common(dst_postinst_dir, src_postinst_dir)
 
-    def _handle_intercept_failure(self, registered_pkgs):
-        self.pm.mark_packages("unpacked", registered_pkgs.split())
-
     def _log_check(self):
         self._log_check_warn()
         self._log_check_error()
@@ -978,9 +919,6 @@ class OpkgRootfs(DpkgOpkgRootfs):
         src_postinst_dir = self.d.expand("${IMAGE_ROOTFS}${OPKGLIBDIR}/opkg/info")
         return self._save_postinsts_common(dst_postinst_dir, src_postinst_dir)
 
-    def _handle_intercept_failure(self, registered_pkgs):
-        self.pm.mark_packages("unpacked", registered_pkgs.split())
-
     def _log_check(self):
         self._log_check_warn()
         self._log_check_error()
-- 
2.16.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/8] package_manager.py: do not hardcode the task name when referring to log files
  2018-04-03 15:45 [PATCH 1/8] nativesdk-postinst-intercept: remove the recipe Alexander Kanavin
                   ` (2 preceding siblings ...)
  2018-04-03 15:45 ` [PATCH 4/8] package_manager.py: move intercept running logic from rootfs class " Alexander Kanavin
@ 2018-04-03 15:45 ` Alexander Kanavin
  2018-04-03 15:45 ` [PATCH 6/8] sdk.py: run postinst intercepts Alexander Kanavin
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alexander Kanavin @ 2018-04-03 15:45 UTC (permalink / raw)
  To: openembedded-core

This can be do_rootfs or do_populate_sdk, or anything else.

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

diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 6c85a6d2c78..840a7bc34c5 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -392,7 +392,7 @@ class PackageManager(object, metaclass=ABCMeta):
                 output = subprocess.check_output(script_full, stderr=subprocess.STDOUT)
                 if output: bb.note(output.decode("utf-8"))
             except subprocess.CalledProcessError as e:
-                bb.warn("The postinstall intercept hook '%s' failed, details in log.do_rootfs" % script)
+                bb.warn("The postinstall intercept hook '%s' failed, details in %s/log.do_%s" % (script, self.d.getVar('T'), self.d.getVar('BB_CURRENTTASK')))
                 bb.note("Exit code %d. Output:\n%s" % (e.returncode, e.output.decode("utf-8")))
                 self._postpone_to_first_boot(script_full)
 
@@ -789,7 +789,7 @@ class RpmPM(PackageManager):
                 failed_scriptlets_pkgnames[line.split()[-1]] = True
 
         if len(failed_scriptlets_pkgnames) > 0:
-            failed_postinsts_warn(list(failed_scriptlets_pkgnames.keys()), self.d.expand("${T}/log.do_rootfs"))
+            failed_postinsts_warn(list(failed_scriptlets_pkgnames.keys()), self.d.expand("${T}/log.do_${BB_CURRENTTASK}"))
         for pkg in failed_scriptlets_pkgnames.keys():
             self.save_rpmpostinst(pkg)
 
@@ -1265,7 +1265,7 @@ class OpkgPM(OpkgDpkgPM):
                     bb.warn(line)
                     failed_pkgs.append(line.split(".")[0])
             if failed_pkgs:
-                failed_postinsts_warn(failed_pkgs, self.d.expand("${T}/log.do_rootfs"))
+                failed_postinsts_warn(failed_pkgs, self.d.expand("${T}/log.do_${BB_CURRENTTASK}"))
         except subprocess.CalledProcessError as e:
             (bb.fatal, bb.warn)[attempt_only]("Unable to install packages. "
                                               "Command '%s' returned %d:\n%s" %
@@ -1530,7 +1530,7 @@ class DpkgPM(OpkgDpkgPM):
                         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_postinsts_warn([pkg_name], self.d.expand("${T}/log.do_${BB_CURRENTTASK}"))
                         failed_pkgs.append(pkg_name)
                         break
 
-- 
2.16.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6/8] sdk.py: run postinst intercepts
  2018-04-03 15:45 [PATCH 1/8] nativesdk-postinst-intercept: remove the recipe Alexander Kanavin
                   ` (3 preceding siblings ...)
  2018-04-03 15:45 ` [PATCH 5/8] package_manager.py: do not hardcode the task name when referring to log files Alexander Kanavin
@ 2018-04-03 15:45 ` Alexander Kanavin
  2018-04-03 15:45 ` [PATCH 7/8] gio-module-cache.bbclass: pass in ${libexecdir} Alexander Kanavin
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alexander Kanavin @ 2018-04-03 15:45 UTC (permalink / raw)
  To: openembedded-core

Previously this wasn't done, and so any packages installed from
populate_sdk would not have the postinsts fully executed
(particularly generation of various caches via running nativesdk or target
binaries with qemu wasn't working).

[YOCTO #12630]

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
---
 meta/classes/populate_sdk_base.bbclass |  2 +-
 meta/lib/oe/sdk.py                     | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/meta/classes/populate_sdk_base.bbclass b/meta/classes/populate_sdk_base.bbclass
index 60a5abc7dc8..77ec8aaec27 100644
--- a/meta/classes/populate_sdk_base.bbclass
+++ b/meta/classes/populate_sdk_base.bbclass
@@ -46,7 +46,7 @@ TOOLCHAIN_TARGET_TASK_ATTEMPTONLY ?= ""
 TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-toolchain-${SDK_VERSION}"
 
 SDK_RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}"
-SDK_DEPENDS = "virtual/fakeroot-native pixz-native cross-localedef-native"
+SDK_DEPENDS = "virtual/fakeroot-native pixz-native cross-localedef-native ${MLPREFIX}qemuwrapper-cross"
 SDK_DEPENDS_append_libc-glibc = " nativesdk-glibc-locale"
 
 # We want the MULTIARCH_TARGET_SYS to point to the TUNE_PKGARCH, not PACKAGE_ARCH as it
diff --git a/meta/lib/oe/sdk.py b/meta/lib/oe/sdk.py
index 6cd4115202f..d6a503372a3 100644
--- a/meta/lib/oe/sdk.py
+++ b/meta/lib/oe/sdk.py
@@ -209,6 +209,8 @@ class RpmSdk(Sdk):
 
         self.target_pm.install_complementary(self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY'))
 
+        self.target_pm.run_intercepts()
+
         execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_TARGET_COMMAND"))
 
         if not bb.utils.contains("SDKIMAGE_FEATURES", "package-management", True, False, self.d):
@@ -218,6 +220,8 @@ class RpmSdk(Sdk):
         self._populate_sysroot(self.host_pm, self.host_manifest)
         self.install_locales(self.host_pm)
 
+        self.host_pm.run_intercepts()
+
         execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_HOST_COMMAND"))
 
         if not bb.utils.contains("SDKIMAGE_FEATURES", "package-management", True, False, self.d):
@@ -293,6 +297,8 @@ class OpkgSdk(Sdk):
 
         self.target_pm.install_complementary(self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY'))
 
+        self.target_pm.run_intercepts()
+
         execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_TARGET_COMMAND"))
 
         if not bb.utils.contains("SDKIMAGE_FEATURES", "package-management", True, False, self.d):
@@ -302,6 +308,8 @@ class OpkgSdk(Sdk):
         self._populate_sysroot(self.host_pm, self.host_manifest)
         self.install_locales(self.host_pm)
 
+        self.host_pm.run_intercepts()
+
         execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_HOST_COMMAND"))
 
         if not bb.utils.contains("SDKIMAGE_FEATURES", "package-management", True, False, self.d):
@@ -378,6 +386,8 @@ class DpkgSdk(Sdk):
 
         self.target_pm.install_complementary(self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY'))
 
+        self.target_pm.run_intercepts()
+
         execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_TARGET_COMMAND"))
 
         self._copy_apt_dir_to(os.path.join(self.sdk_target_sysroot, "etc", "apt"))
@@ -389,6 +399,8 @@ class DpkgSdk(Sdk):
         self._populate_sysroot(self.host_pm, self.host_manifest)
         self.install_locales(self.host_pm)
 
+        self.host_pm.run_intercepts()
+
         execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_HOST_COMMAND"))
 
         self._copy_apt_dir_to(os.path.join(self.sdk_output, self.sdk_native_path,
-- 
2.16.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 7/8] gio-module-cache.bbclass: pass in ${libexecdir}
  2018-04-03 15:45 [PATCH 1/8] nativesdk-postinst-intercept: remove the recipe Alexander Kanavin
                   ` (4 preceding siblings ...)
  2018-04-03 15:45 ` [PATCH 6/8] sdk.py: run postinst intercepts Alexander Kanavin
@ 2018-04-03 15:45 ` Alexander Kanavin
  2018-04-03 15:45 ` [PATCH 8/8] glib-2.0/glib.inc: apply MLPREFIX renaming to all package classes Alexander Kanavin
  2018-04-03 16:03 ` ✗ patchtest: failure for "nativesdk-postinst-intercept: ..." and 7 more Patchwork
  7 siblings, 0 replies; 9+ messages in thread
From: Alexander Kanavin @ 2018-04-03 15:45 UTC (permalink / raw)
  To: openembedded-core

When it was something else than /usr/libexec (e.g. when
installing native SDK packages), things broke down.

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
---
 meta/classes/gio-module-cache.bbclass | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/classes/gio-module-cache.bbclass b/meta/classes/gio-module-cache.bbclass
index a8190b7b89a..e429bd31976 100644
--- a/meta/classes/gio-module-cache.bbclass
+++ b/meta/classes/gio-module-cache.bbclass
@@ -9,6 +9,7 @@ if [ "x$D" != "x" ]; then
             mlprefix=${MLPREFIX} \
             binprefix=${MLPREFIX} \
             libdir=${libdir} \
+            libexecdir=${libexecdir} \
             base_libdir=${base_libdir} \
             bindir=${bindir}
 else
-- 
2.16.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 8/8] glib-2.0/glib.inc: apply MLPREFIX renaming to all package classes
  2018-04-03 15:45 [PATCH 1/8] nativesdk-postinst-intercept: remove the recipe Alexander Kanavin
                   ` (5 preceding siblings ...)
  2018-04-03 15:45 ` [PATCH 7/8] gio-module-cache.bbclass: pass in ${libexecdir} Alexander Kanavin
@ 2018-04-03 15:45 ` Alexander Kanavin
  2018-04-03 16:03 ` ✗ patchtest: failure for "nativesdk-postinst-intercept: ..." and 7 more Patchwork
  7 siblings, 0 replies; 9+ messages in thread
From: Alexander Kanavin @ 2018-04-03 15:45 UTC (permalink / raw)
  To: openembedded-core

Now that we have postinst intercept execution working for SDK generation,
adding MLPREFIX again makes sense in all cases, as the intercepts do require
that it is there.

This reverts commit 4ffb728df4bdf21daef31d89cfa5771eaf0d90f8.

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
---
 meta/recipes-core/glib-2.0/glib.inc | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/meta/recipes-core/glib-2.0/glib.inc b/meta/recipes-core/glib-2.0/glib.inc
index 7e062eeb5da..b7c32e64bc8 100644
--- a/meta/recipes-core/glib-2.0/glib.inc
+++ b/meta/recipes-core/glib-2.0/glib.inc
@@ -104,6 +104,11 @@ do_install_append () {
 	if [ -e ${D}${libdir}/charset.alias ]; then
 		rm -f ${D}${libdir}/charset.alias
 	fi
+
+        # Make sure gio-querymodules is unique among multilibs
+        if test "x${MLPREFIX}" != "x"; then
+                mv ${D}${libexecdir}/gio-querymodules ${D}${libexecdir}/${MLPREFIX}gio-querymodules
+        fi
 }
 
 do_install_append_class-target () {
@@ -114,11 +119,6 @@ do_install_append_class-target () {
 			rm ${D}${datadir}/installed-tests/glib/gdbus-serialization.test
 		fi
 	fi
-
-	# Make sure gio-querymodules is unique among multilibs
-	if test "x${MLPREFIX}" != "x"; then
-		mv ${D}${libexecdir}/gio-querymodules ${D}${libexecdir}/${MLPREFIX}gio-querymodules
-	fi
 }
 
 CODEGEN_PYTHON_RDEPENDS = "python3 python3-distutils python3-xml"
-- 
2.16.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* ✗ patchtest: failure for "nativesdk-postinst-intercept: ..." and 7 more
  2018-04-03 15:45 [PATCH 1/8] nativesdk-postinst-intercept: remove the recipe Alexander Kanavin
                   ` (6 preceding siblings ...)
  2018-04-03 15:45 ` [PATCH 8/8] glib-2.0/glib.inc: apply MLPREFIX renaming to all package classes Alexander Kanavin
@ 2018-04-03 16:03 ` Patchwork
  7 siblings, 0 replies; 9+ messages in thread
From: Patchwork @ 2018-04-03 16:03 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: openembedded-core

== Series Details ==

Series: "nativesdk-postinst-intercept: ..." and 7 more
Revision: 1
URL   : https://patchwork.openembedded.org/series/11661/
State : failure

== Summary ==


Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following failures:



* Patch            [3/8] package_manager.py: move postinst_intercept dir initialization from RootFS to PackageManager class
 Issue             Commit shortlog is too long [test_shortlog_length] 
  Suggested fix    Edit shortlog so that it is 90 characters or less (currently 98 characters)



If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).

---
Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-04-03 16:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-03 15:45 [PATCH 1/8] nativesdk-postinst-intercept: remove the recipe Alexander Kanavin
2018-04-03 15:45 ` [PATCH 2/8] package_manager.py: move target_rootfs property to common ancestor class Alexander Kanavin
2018-04-03 15:45 ` [PATCH 3/8] package_manager.py: move postinst_intercept dir initialization from RootFS to PackageManager class Alexander Kanavin
2018-04-03 15:45 ` [PATCH 4/8] package_manager.py: move intercept running logic from rootfs class " Alexander Kanavin
2018-04-03 15:45 ` [PATCH 5/8] package_manager.py: do not hardcode the task name when referring to log files Alexander Kanavin
2018-04-03 15:45 ` [PATCH 6/8] sdk.py: run postinst intercepts Alexander Kanavin
2018-04-03 15:45 ` [PATCH 7/8] gio-module-cache.bbclass: pass in ${libexecdir} Alexander Kanavin
2018-04-03 15:45 ` [PATCH 8/8] glib-2.0/glib.inc: apply MLPREFIX renaming to all package classes Alexander Kanavin
2018-04-03 16:03 ` ✗ patchtest: failure for "nativesdk-postinst-intercept: ..." and 7 more Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.