summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorAlexander Kanavin <alexander.kanavin@linux.intel.com>2018-04-03 18:45:19 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-04-05 14:49:07 +0100
commit19cd7a1776df6610cf9721275d6ef69115f9426a (patch)
treed4fba34f8f144c6f90ef9c25611f25752a62190e /meta
parentb224c4e1526f6b2c574c19a7782b90e456e64f6d (diff)
downloadpoky-19cd7a1776df6610cf9721275d6ef69115f9426a.tar.gz
package_manager.py: move postinst_intercept dir initialization from RootFS to PackageManager class
This will allow handling postinst_intercepts when populating SDKs (which use PackageManager class directly, and do not utilize RootFS class). (From OE-Core rev: 9454fd328040fd58c981d028a74fcf181bde8e89) Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oe/package_manager.py25
-rw-r--r--meta/lib/oe/rootfs.py13
2 files changed, 20 insertions, 18 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index a568b2a41a..b95b3b96a8 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -12,6 +12,7 @@ import oe.utils
12import oe.path 12import oe.path
13import string 13import string
14from oe.gpg_sign import get_signer 14from oe.gpg_sign import get_signer
15import hashlib
15 16
16# this can be used by all PM backends to create the index files in parallel 17# this can be used by all PM backends to create the index files in parallel
17def create_index(arg): 18def create_index(arg):
@@ -331,6 +332,21 @@ class PackageManager(object, metaclass=ABCMeta):
331 self.target_rootfs = target_rootfs 332 self.target_rootfs = target_rootfs
332 self.deploy_dir = None 333 self.deploy_dir = None
333 self.deploy_lock = None 334 self.deploy_lock = None
335 self._initialize_intercepts()
336
337 def _initialize_intercepts(self):
338 bb.note("Initializing intercept dir for %s" % self.target_rootfs)
339 postinst_intercepts_dir = self.d.getVar("POSTINST_INTERCEPTS_DIR")
340 if not postinst_intercepts_dir:
341 postinst_intercepts_dir = self.d.expand("${COREBASE}/scripts/postinst-intercepts")
342 # As there might be more than one instance of PackageManager operating at the same time
343 # we need to isolate the intercept_scripts directories from each other,
344 # hence the ugly hash digest in dir name.
345 self.intercepts_dir = os.path.join(self.d.getVar('WORKDIR'),
346 "intercept_scripts-%s" %(hashlib.sha256(self.target_rootfs.encode()).hexdigest()) )
347
348 bb.utils.remove(self.intercepts_dir, True)
349 shutil.copytree(postinst_intercepts_dir, self.intercepts_dir)
334 350
335 @abstractmethod 351 @abstractmethod
336 def update(self): 352 def update(self):
@@ -699,8 +715,7 @@ class RpmPM(PackageManager):
699 os.environ['OFFLINE_ROOT'] = self.target_rootfs 715 os.environ['OFFLINE_ROOT'] = self.target_rootfs
700 os.environ['IPKG_OFFLINE_ROOT'] = self.target_rootfs 716 os.environ['IPKG_OFFLINE_ROOT'] = self.target_rootfs
701 os.environ['OPKG_OFFLINE_ROOT'] = self.target_rootfs 717 os.environ['OPKG_OFFLINE_ROOT'] = self.target_rootfs
702 os.environ['INTERCEPT_DIR'] = oe.path.join(self.d.getVar('WORKDIR'), 718 os.environ['INTERCEPT_DIR'] = self.intercepts_dir
703 "intercept_scripts")
704 os.environ['NATIVE_ROOT'] = self.d.getVar('STAGING_DIR_NATIVE') 719 os.environ['NATIVE_ROOT'] = self.d.getVar('STAGING_DIR_NATIVE')
705 720
706 721
@@ -1178,8 +1193,7 @@ class OpkgPM(OpkgDpkgPM):
1178 os.environ['OFFLINE_ROOT'] = self.target_rootfs 1193 os.environ['OFFLINE_ROOT'] = self.target_rootfs
1179 os.environ['IPKG_OFFLINE_ROOT'] = self.target_rootfs 1194 os.environ['IPKG_OFFLINE_ROOT'] = self.target_rootfs
1180 os.environ['OPKG_OFFLINE_ROOT'] = self.target_rootfs 1195 os.environ['OPKG_OFFLINE_ROOT'] = self.target_rootfs
1181 os.environ['INTERCEPT_DIR'] = os.path.join(self.d.getVar('WORKDIR'), 1196 os.environ['INTERCEPT_DIR'] = self.intercepts_dir
1182 "intercept_scripts")
1183 os.environ['NATIVE_ROOT'] = self.d.getVar('STAGING_DIR_NATIVE') 1197 os.environ['NATIVE_ROOT'] = self.d.getVar('STAGING_DIR_NATIVE')
1184 1198
1185 try: 1199 try:
@@ -1440,8 +1454,7 @@ class DpkgPM(OpkgDpkgPM):
1440 os.environ['OFFLINE_ROOT'] = self.target_rootfs 1454 os.environ['OFFLINE_ROOT'] = self.target_rootfs
1441 os.environ['IPKG_OFFLINE_ROOT'] = self.target_rootfs 1455 os.environ['IPKG_OFFLINE_ROOT'] = self.target_rootfs
1442 os.environ['OPKG_OFFLINE_ROOT'] = self.target_rootfs 1456 os.environ['OPKG_OFFLINE_ROOT'] = self.target_rootfs
1443 os.environ['INTERCEPT_DIR'] = os.path.join(self.d.getVar('WORKDIR'), 1457 os.environ['INTERCEPT_DIR'] = self.intercepts_dir
1444 "intercept_scripts")
1445 os.environ['NATIVE_ROOT'] = self.d.getVar('STAGING_DIR_NATIVE') 1458 os.environ['NATIVE_ROOT'] = self.d.getVar('STAGING_DIR_NATIVE')
1446 1459
1447 failed_pkgs = [] 1460 failed_pkgs = []
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index bf2aea2b25..600a685d68 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -178,20 +178,10 @@ class Rootfs(object, metaclass=ABCMeta):
178 post_process_cmds = self.d.getVar("ROOTFS_POSTPROCESS_COMMAND") 178 post_process_cmds = self.d.getVar("ROOTFS_POSTPROCESS_COMMAND")
179 rootfs_post_install_cmds = self.d.getVar('ROOTFS_POSTINSTALL_COMMAND') 179 rootfs_post_install_cmds = self.d.getVar('ROOTFS_POSTINSTALL_COMMAND')
180 180
181 postinst_intercepts_dir = self.d.getVar("POSTINST_INTERCEPTS_DIR")
182 if not postinst_intercepts_dir:
183 postinst_intercepts_dir = self.d.expand("${COREBASE}/scripts/postinst-intercepts")
184 intercepts_dir = os.path.join(self.d.getVar('WORKDIR'),
185 "intercept_scripts")
186
187 bb.utils.remove(intercepts_dir, True)
188
189 bb.utils.mkdirhier(self.image_rootfs) 181 bb.utils.mkdirhier(self.image_rootfs)
190 182
191 bb.utils.mkdirhier(self.deploydir) 183 bb.utils.mkdirhier(self.deploydir)
192 184
193 shutil.copytree(postinst_intercepts_dir, intercepts_dir)
194
195 execute_pre_post_process(self.d, pre_process_cmds) 185 execute_pre_post_process(self.d, pre_process_cmds)
196 186
197 if self.progress_reporter: 187 if self.progress_reporter:
@@ -312,8 +302,7 @@ class Rootfs(object, metaclass=ABCMeta):
312 302
313 303
314 def _run_intercepts(self): 304 def _run_intercepts(self):
315 intercepts_dir = os.path.join(self.d.getVar('WORKDIR'), 305 intercepts_dir = self.pm.intercepts_dir
316 "intercept_scripts")
317 306
318 bb.note("Running intercept scripts:") 307 bb.note("Running intercept scripts:")
319 os.environ['D'] = self.image_rootfs 308 os.environ['D'] = self.image_rootfs