summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2018-07-27 22:24:27 +0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-08-16 09:49:32 +0100
commit9ba2f2b1df277b2b881f68166d9cd1c19db66e23 (patch)
tree0ddf536282fe76fd7276b7eb013d1f7d09e85e7c /meta/lib
parente7c0ad5d3eff6b1d7170e7e0a539d1807a2bb452 (diff)
downloadopenembedded-core-contrib-9ba2f2b1df277b2b881f68166d9cd1c19db66e23.tar.gz
openembedded-core-contrib-9ba2f2b1df277b2b881f68166d9cd1c19db66e23.tar.bz2
openembedded-core-contrib-9ba2f2b1df277b2b881f68166d9cd1c19db66e23.zip
oe.package_manager: support loading intercepts from multiple paths
- 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> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/package_manager.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 858891ca21..398838835e 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -379,17 +379,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):