All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2 0/4] Pull postinst-intercepts from BBPATH
@ 2018-07-27 17:24 Christopher Larson
  2018-07-27 17:24 ` [PATCHv2 1/4] oe.package_manager: support loading intercepts from multiple paths Christopher Larson
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Christopher Larson @ 2018-07-27 17:24 UTC (permalink / raw)
  To: openembedded-core; +Cc: Christopher Larson

From: Christopher Larson <chris_larson@mentor.com>

These are the bits to  allow us to pull intercepts from BBPATH. This is kept
as a separate class, as it's needed by both image construction and sdk
construction, the latter to support meta-toolchain & similar recipes.

The following changes since commit 364449251ffe4ff2c11acaa258edcec244c38818:

  classes/package: fix variable name in comment (2018-07-26 16:55:21 +0100)

are available in the git repository at:

  git@github.com:kergoth/openembedded-core.git bbpath-intercepts

for you to fetch changes up to fc32ec263034818cd182e093685d776b8d50a3a2:

  populate_sdk_base.bbclass: inherit and use image-postinst-intercepts (2018-07-27 22:04:40 +0500)

----------------------------------------------------------------

v2 changes:
- rebased
- renamed bbpath-intercepts.bbclass to image-postinst-intercepts.bbclass, as
  requested by Richard

Christopher Larson (4):
  oe.package_manager: support loading intercepts from multiple paths
  image-postinst-intercepts.bbclass: add class
  image.bbclass: inherit and use image-postinst-intercepts
  populate_sdk_base.bbclass: inherit and use image-postinst-intercepts

 meta/classes/image-postinst-intercepts.bbclass | 23 +++++++++++++++++++++++
 meta/classes/image.bbclass                     |  2 ++
 meta/classes/populate_sdk_base.bbclass         |  3 ++-
 meta/lib/oe/package_manager.py                 | 19 +++++++++++++------
 4 files changed, 40 insertions(+), 7 deletions(-)
 create mode 100644 meta/classes/image-postinst-intercepts.bbclass

-- 
2.11.1



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

* [PATCHv2 1/4] oe.package_manager: support loading intercepts from multiple paths
  2018-07-27 17:24 [PATCHv2 0/4] Pull postinst-intercepts from BBPATH Christopher Larson
@ 2018-07-27 17:24 ` Christopher Larson
  2018-07-27 17:24 ` [PATCHv2 2/4] image-postinst-intercepts.bbclass: add class Christopher Larson
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Christopher Larson @ 2018-07-27 17:24 UTC (permalink / raw)
  To: openembedded-core; +Cc: Christopher Larson

From: Christopher Larson <chris_larson@mentor.com>

- if POSTINST_INTERCEPTS is set, use the listed intercept files, or
- if POSTINST_INTERCEPTS_PATH is set, load from the listed paths, or
- if POSTINST_INTERCEPTS_DIR is set, load from it (for compatibility), or
- load from ${COREBASE}/meta/postinst-intercepts

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
---
 meta/lib/oe/package_manager.py | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 64c8a912160..b983943f1f6 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -335,17 +335,24 @@ class PackageManager(object, metaclass=ABCMeta):
 
     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()) )
+        self.intercepts_dir = os.path.join(self.d.getVar('WORKDIR'), "intercept_scripts-%s" %
+                                           (hashlib.sha256(self.target_rootfs.encode()).hexdigest()))
 
+        postinst_intercepts = (self.d.getVar("POSTINST_INTERCEPTS") or "").split()
+        if not postinst_intercepts:
+            postinst_intercepts_path = self.d.getVar("POSTINST_INTERCEPTS_PATH")
+            if not postinst_intercepts_path:
+                postinst_intercepts_path = self.d.getVar("POSTINST_INTERCEPTS_DIR") or self.d.expand("${COREBASE}/scripts/postinst-intercepts")
+            postinst_intercepts = oe.path.which_wild('*', postinst_intercepts_path)
+
+        bb.debug(1, 'Collected intercepts:\n%s' % ''.join('  %s\n' % i for i in postinst_intercepts))
         bb.utils.remove(self.intercepts_dir, True)
-        shutil.copytree(postinst_intercepts_dir, self.intercepts_dir)
+        bb.utils.mkdirhier(self.intercepts_dir)
+        for intercept in postinst_intercepts:
+            bb.utils.copyfile(intercept, os.path.join(self.intercepts_dir, os.path.basename(intercept)))
 
     @abstractmethod
     def _handle_intercept_failure(self, failed_script):
-- 
2.11.1



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

* [PATCHv2 2/4] image-postinst-intercepts.bbclass: add class
  2018-07-27 17:24 [PATCHv2 0/4] Pull postinst-intercepts from BBPATH Christopher Larson
  2018-07-27 17:24 ` [PATCHv2 1/4] oe.package_manager: support loading intercepts from multiple paths Christopher Larson
@ 2018-07-27 17:24 ` Christopher Larson
  2018-07-27 17:24 ` [PATCHv2 3/4] image.bbclass: inherit and use image-postinst-intercepts Christopher Larson
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Christopher Larson @ 2018-07-27 17:24 UTC (permalink / raw)
  To: openembedded-core; +Cc: Christopher Larson

From: Christopher Larson <chris_larson@mentor.com>

This class sets POSTINST_INTERCEPTS and POSTINST_INTERCEPTS_CHECKSUMS,
to allow us to pull intercepts from BBPATH. This is kept as a separate
class, as it's needed by both image construction and sdk construction,
the latter to support meta-toolchain & similar recipes.

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
---
 meta/classes/image-postinst-intercepts.bbclass | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 meta/classes/image-postinst-intercepts.bbclass

diff --git a/meta/classes/image-postinst-intercepts.bbclass b/meta/classes/image-postinst-intercepts.bbclass
new file mode 100644
index 00000000000..ed30bbd98d9
--- /dev/null
+++ b/meta/classes/image-postinst-intercepts.bbclass
@@ -0,0 +1,23 @@
+# Gather existing and candidate postinst intercepts from BBPATH
+POSTINST_INTERCEPTS_DIR ?= "${COREBASE}/scripts/postinst-intercepts"
+POSTINST_INTERCEPTS_PATHS ?= "${@':'.join('%s/postinst-intercepts' % p for p in '${BBPATH}'.split(':'))}:${POSTINST_INTERCEPTS_DIR}"
+
+python find_intercepts() {
+    intercepts = {}
+    search_paths = []
+    paths = d.getVar('POSTINST_INTERCEPTS_PATHS').split(':')
+    overrides = (':' + d.getVar('FILESOVERRIDES')).split(':') + ['']
+    search_paths = [os.path.join(p, op) for p in paths for op in overrides]
+    searched = oe.path.which_wild('*', ':'.join(search_paths), candidates=True)
+    files, chksums = [], []
+    for pathname, candidates in searched:
+        if os.path.isfile(pathname):
+            files.append(pathname)
+            chksums.append('%s:True' % pathname)
+            chksums.extend('%s:False' % c for c in candidates[:-1])
+
+    d.setVar('POSTINST_INTERCEPT_CHECKSUMS', ' '.join(chksums))
+    d.setVar('POSTINST_INTERCEPTS', ' '.join(files))
+}
+find_intercepts[eventmask] += "bb.event.RecipePreFinalise"
+addhandler find_intercepts
-- 
2.11.1



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

* [PATCHv2 3/4] image.bbclass: inherit and use image-postinst-intercepts
  2018-07-27 17:24 [PATCHv2 0/4] Pull postinst-intercepts from BBPATH Christopher Larson
  2018-07-27 17:24 ` [PATCHv2 1/4] oe.package_manager: support loading intercepts from multiple paths Christopher Larson
  2018-07-27 17:24 ` [PATCHv2 2/4] image-postinst-intercepts.bbclass: add class Christopher Larson
@ 2018-07-27 17:24 ` Christopher Larson
  2018-07-27 17:24 ` [PATCHv2 4/4] populate_sdk_base.bbclass: " Christopher Larson
  2018-08-15 16:46 ` [PATCHv2 0/4] Pull postinst-intercepts from BBPATH Christopher Larson
  4 siblings, 0 replies; 6+ messages in thread
From: Christopher Larson @ 2018-07-27 17:24 UTC (permalink / raw)
  To: openembedded-core; +Cc: Christopher Larson

From: Christopher Larson <chris_larson@mentor.com>

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
---
 meta/classes/image.bbclass | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index c3e73676dca..c0f6ffe31d4 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -14,6 +14,7 @@ IMGCLASSES += "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso hddimg', 'ima
 IMGCLASSES += "${@bb.utils.contains('IMAGE_FSTYPES', 'container', 'image-container', '', d)}"
 IMGCLASSES += "image_types_wic"
 IMGCLASSES += "rootfs-postcommands"
+IMGCLASSES += "image-postinst-intercepts"
 inherit ${IMGCLASSES}
 
 TOOLCHAIN_TARGET_TASK += "${PACKAGE_INSTALL}"
@@ -246,6 +247,7 @@ fakeroot python do_rootfs () {
 do_rootfs[dirs] = "${TOPDIR}"
 do_rootfs[cleandirs] += "${S} ${IMGDEPLOYDIR}"
 do_rootfs[umask] = "022"
+do_rootfs[file-checksums] += "${POSTINST_INTERCEPT_CHECKSUMS}"
 addtask rootfs after do_prepare_recipe_sysroot
 
 fakeroot python do_image () {
-- 
2.11.1



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

* [PATCHv2 4/4] populate_sdk_base.bbclass: inherit and use image-postinst-intercepts
  2018-07-27 17:24 [PATCHv2 0/4] Pull postinst-intercepts from BBPATH Christopher Larson
                   ` (2 preceding siblings ...)
  2018-07-27 17:24 ` [PATCHv2 3/4] image.bbclass: inherit and use image-postinst-intercepts Christopher Larson
@ 2018-07-27 17:24 ` Christopher Larson
  2018-08-15 16:46 ` [PATCHv2 0/4] Pull postinst-intercepts from BBPATH Christopher Larson
  4 siblings, 0 replies; 6+ messages in thread
From: Christopher Larson @ 2018-07-27 17:24 UTC (permalink / raw)
  To: openembedded-core; +Cc: Christopher Larson

From: Christopher Larson <chris_larson@mentor.com>

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
---
 meta/classes/populate_sdk_base.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/classes/populate_sdk_base.bbclass b/meta/classes/populate_sdk_base.bbclass
index 7ffaf84a45d..c456c52866a 100644
--- a/meta/classes/populate_sdk_base.bbclass
+++ b/meta/classes/populate_sdk_base.bbclass
@@ -1,4 +1,4 @@
-inherit meta
+inherit meta image-postinst-intercepts
 
 # Wildcards specifying complementary packages to install for every package that has been explicitly
 # installed into the rootfs
@@ -307,4 +307,5 @@ do_populate_sdk[dirs] = "${PKGDATA_DIR} ${TOPDIR}"
 do_populate_sdk[depends] += "${@' '.join([x + ':do_populate_sysroot' for x in d.getVar('SDK_DEPENDS').split()])}  ${@d.getVarFlag('do_rootfs', 'depends', False)}"
 do_populate_sdk[rdepends] = "${@' '.join([x + ':do_package_write_${IMAGE_PKGTYPE} ' + x + ':do_packagedata' for x in d.getVar('SDK_RDEPENDS').split()])}"
 do_populate_sdk[recrdeptask] += "do_packagedata do_package_write_rpm do_package_write_ipk do_package_write_deb"
+do_populate_sdk[file-checksums] += "${POSTINST_INTERCEPT_CHECKSUMS}"
 addtask populate_sdk
-- 
2.11.1



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

* Re: [PATCHv2 0/4] Pull postinst-intercepts from BBPATH
  2018-07-27 17:24 [PATCHv2 0/4] Pull postinst-intercepts from BBPATH Christopher Larson
                   ` (3 preceding siblings ...)
  2018-07-27 17:24 ` [PATCHv2 4/4] populate_sdk_base.bbclass: " Christopher Larson
@ 2018-08-15 16:46 ` Christopher Larson
  4 siblings, 0 replies; 6+ messages in thread
From: Christopher Larson @ 2018-08-15 16:46 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 712 bytes --]

On Fri, Jul 27, 2018 at 10:24 AM Christopher Larson <kergoth@gmail.com>
wrote:

> From: Christopher Larson <chris_larson@mentor.com>
>
> These are the bits to  allow us to pull intercepts from BBPATH. This is
> kept
> as a separate class, as it's needed by both image construction and sdk
> construction, the latter to support meta-toolchain & similar recipes.
>

Ping. v2 renamed bbpath-intercepts to image-postinst-intercepts and
rebased. Let me know if there are any other concerns. Not urgent, just want
to make sure it doesn't fall through the cracks :)
-- 
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics

[-- Attachment #2: Type: text/html, Size: 1224 bytes --]

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

end of thread, other threads:[~2018-08-15 16:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-27 17:24 [PATCHv2 0/4] Pull postinst-intercepts from BBPATH Christopher Larson
2018-07-27 17:24 ` [PATCHv2 1/4] oe.package_manager: support loading intercepts from multiple paths Christopher Larson
2018-07-27 17:24 ` [PATCHv2 2/4] image-postinst-intercepts.bbclass: add class Christopher Larson
2018-07-27 17:24 ` [PATCHv2 3/4] image.bbclass: inherit and use image-postinst-intercepts Christopher Larson
2018-07-27 17:24 ` [PATCHv2 4/4] populate_sdk_base.bbclass: " Christopher Larson
2018-08-15 16:46 ` [PATCHv2 0/4] Pull postinst-intercepts from BBPATH Christopher Larson

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.