summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/package_manager.py
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:39 +0100
commit85518a20017c1a091f3a393f09fb2ceffe057bed (patch)
treebfe4f2effb4ea973a7c81d8db72fd4f1c59afec8 /meta/lib/oe/package_manager.py
parent9897d02e13f30f6a2c8f03b0b666768cf6e3ba43 (diff)
downloadpoky-85518a20017c1a091f3a393f09fb2ceffe057bed.tar.gz
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 (From OE-Core rev: 9ba2f2b1df277b2b881f68166d9cd1c19db66e23) Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/package_manager.py')
-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):
379 379
380 def _initialize_intercepts(self): 380 def _initialize_intercepts(self):
381 bb.note("Initializing intercept dir for %s" % self.target_rootfs) 381 bb.note("Initializing intercept dir for %s" % self.target_rootfs)
382 postinst_intercepts_dir = self.d.getVar("POSTINST_INTERCEPTS_DIR")
383 if not postinst_intercepts_dir:
384 postinst_intercepts_dir = self.d.expand("${COREBASE}/scripts/postinst-intercepts")
385 # As there might be more than one instance of PackageManager operating at the same time 382 # As there might be more than one instance of PackageManager operating at the same time
386 # we need to isolate the intercept_scripts directories from each other, 383 # we need to isolate the intercept_scripts directories from each other,
387 # hence the ugly hash digest in dir name. 384 # hence the ugly hash digest in dir name.
388 self.intercepts_dir = os.path.join(self.d.getVar('WORKDIR'), 385 self.intercepts_dir = os.path.join(self.d.getVar('WORKDIR'), "intercept_scripts-%s" %
389 "intercept_scripts-%s" %(hashlib.sha256(self.target_rootfs.encode()).hexdigest()) ) 386 (hashlib.sha256(self.target_rootfs.encode()).hexdigest()))
390 387
388 postinst_intercepts = (self.d.getVar("POSTINST_INTERCEPTS") or "").split()
389 if not postinst_intercepts:
390 postinst_intercepts_path = self.d.getVar("POSTINST_INTERCEPTS_PATH")
391 if not postinst_intercepts_path:
392 postinst_intercepts_path = self.d.getVar("POSTINST_INTERCEPTS_DIR") or self.d.expand("${COREBASE}/scripts/postinst-intercepts")
393 postinst_intercepts = oe.path.which_wild('*', postinst_intercepts_path)
394
395 bb.debug(1, 'Collected intercepts:\n%s' % ''.join(' %s\n' % i for i in postinst_intercepts))
391 bb.utils.remove(self.intercepts_dir, True) 396 bb.utils.remove(self.intercepts_dir, True)
392 shutil.copytree(postinst_intercepts_dir, self.intercepts_dir) 397 bb.utils.mkdirhier(self.intercepts_dir)
398 for intercept in postinst_intercepts:
399 bb.utils.copyfile(intercept, os.path.join(self.intercepts_dir, os.path.basename(intercept)))
393 400
394 @abstractmethod 401 @abstractmethod
395 def _handle_intercept_failure(self, failed_script): 402 def _handle_intercept_failure(self, failed_script):