diff options
Diffstat (limited to 'meta/lib/oe/package_manager/ipk/sdk.py')
| -rw-r--r-- | meta/lib/oe/package_manager/ipk/sdk.py | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/meta/lib/oe/package_manager/ipk/sdk.py b/meta/lib/oe/package_manager/ipk/sdk.py deleted file mode 100644 index 3acd55f548..0000000000 --- a/meta/lib/oe/package_manager/ipk/sdk.py +++ /dev/null | |||
| @@ -1,113 +0,0 @@ | |||
| 1 | # | ||
| 2 | # Copyright OpenEmbedded Contributors | ||
| 3 | # | ||
| 4 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 5 | # | ||
| 6 | |||
| 7 | import glob | ||
| 8 | import shutil | ||
| 9 | from oe.utils import execute_pre_post_process | ||
| 10 | from oe.sdk import Sdk | ||
| 11 | from oe.package_manager.ipk.manifest import PkgManifest | ||
| 12 | from oe.manifest import Manifest | ||
| 13 | from oe.package_manager.ipk import OpkgPM | ||
| 14 | |||
| 15 | class PkgSdk(Sdk): | ||
| 16 | def __init__(self, d, manifest_dir=None): | ||
| 17 | super(PkgSdk, self).__init__(d, manifest_dir) | ||
| 18 | |||
| 19 | # In sdk_list_installed_packages the call to opkg is hardcoded to | ||
| 20 | # always use IPKGCONF_TARGET and there's no exposed API to change this | ||
| 21 | # so simply override IPKGCONF_TARGET to use this separated config file. | ||
| 22 | ipkgconf_sdk_target = d.getVar("IPKGCONF_SDK_TARGET") | ||
| 23 | d.setVar("IPKGCONF_TARGET", ipkgconf_sdk_target) | ||
| 24 | |||
| 25 | self.target_conf = self.d.getVar("IPKGCONF_TARGET") | ||
| 26 | self.host_conf = self.d.getVar("IPKGCONF_SDK") | ||
| 27 | |||
| 28 | self.target_manifest = PkgManifest(d, self.manifest_dir, | ||
| 29 | Manifest.MANIFEST_TYPE_SDK_TARGET) | ||
| 30 | self.host_manifest = PkgManifest(d, self.manifest_dir, | ||
| 31 | Manifest.MANIFEST_TYPE_SDK_HOST) | ||
| 32 | |||
| 33 | ipk_repo_workdir = "oe-sdk-repo" | ||
| 34 | if "sdk_ext" in d.getVar("BB_RUNTASK"): | ||
| 35 | ipk_repo_workdir = "oe-sdk-ext-repo" | ||
| 36 | |||
| 37 | self.target_pm = OpkgPM(d, self.sdk_target_sysroot, self.target_conf, | ||
| 38 | self.d.getVar("ALL_MULTILIB_PACKAGE_ARCHS"), | ||
| 39 | ipk_repo_workdir=ipk_repo_workdir) | ||
| 40 | |||
| 41 | self.host_pm = OpkgPM(d, self.sdk_host_sysroot, self.host_conf, | ||
| 42 | self.d.getVar("SDK_PACKAGE_ARCHS"), | ||
| 43 | ipk_repo_workdir=ipk_repo_workdir) | ||
| 44 | |||
| 45 | def _populate_sysroot(self, pm, manifest): | ||
| 46 | pkgs_to_install = manifest.parse_initial_manifest() | ||
| 47 | |||
| 48 | if (self.d.getVar('BUILD_IMAGES_FROM_FEEDS') or "") != "1": | ||
| 49 | pm.write_index() | ||
| 50 | |||
| 51 | pm.update() | ||
| 52 | |||
| 53 | for pkg_type in self.install_order: | ||
| 54 | if pkg_type in pkgs_to_install: | ||
| 55 | pm.install(pkgs_to_install[pkg_type], | ||
| 56 | [False, True][pkg_type == Manifest.PKG_TYPE_ATTEMPT_ONLY]) | ||
| 57 | |||
| 58 | def _populate(self): | ||
| 59 | execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_PRE_TARGET_COMMAND")) | ||
| 60 | |||
| 61 | bb.note("Installing TARGET packages") | ||
| 62 | self._populate_sysroot(self.target_pm, self.target_manifest) | ||
| 63 | |||
| 64 | self.target_pm.install_complementary(self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY')) | ||
| 65 | |||
| 66 | env_bkp = os.environ.copy() | ||
| 67 | os.environ['PATH'] = self.d.expand("${COREBASE}/scripts/nativesdk-intercept") + \ | ||
| 68 | os.pathsep + os.environ["PATH"] | ||
| 69 | |||
| 70 | self.target_pm.run_intercepts(populate_sdk='target') | ||
| 71 | os.environ.update(env_bkp) | ||
| 72 | |||
| 73 | execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_TARGET_COMMAND")) | ||
| 74 | |||
| 75 | if not bb.utils.contains("SDKIMAGE_FEATURES", "package-management", True, False, self.d): | ||
| 76 | self.target_pm.remove_packaging_data() | ||
| 77 | else: | ||
| 78 | self.target_pm.remove_lists() | ||
| 79 | |||
| 80 | bb.note("Installing NATIVESDK packages") | ||
| 81 | self._populate_sysroot(self.host_pm, self.host_manifest) | ||
| 82 | self.install_locales(self.host_pm) | ||
| 83 | |||
| 84 | self.host_pm.run_intercepts(populate_sdk='host') | ||
| 85 | |||
| 86 | execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_HOST_COMMAND")) | ||
| 87 | |||
| 88 | if not bb.utils.contains("SDKIMAGE_FEATURES", "package-management", True, False, self.d): | ||
| 89 | self.host_pm.remove_packaging_data() | ||
| 90 | else: | ||
| 91 | self.host_pm.remove_lists() | ||
| 92 | |||
| 93 | target_sysconfdir = os.path.join(self.sdk_target_sysroot, self.sysconfdir) | ||
| 94 | host_sysconfdir = os.path.join(self.sdk_host_sysroot, self.sysconfdir) | ||
| 95 | |||
| 96 | self.mkdirhier(target_sysconfdir) | ||
| 97 | shutil.copy(self.target_conf, target_sysconfdir) | ||
| 98 | os.chmod(os.path.join(target_sysconfdir, | ||
| 99 | os.path.basename(self.target_conf)), 0o644) | ||
| 100 | |||
| 101 | self.mkdirhier(host_sysconfdir) | ||
| 102 | shutil.copy(self.host_conf, host_sysconfdir) | ||
| 103 | os.chmod(os.path.join(host_sysconfdir, | ||
| 104 | os.path.basename(self.host_conf)), 0o644) | ||
| 105 | |||
| 106 | native_opkg_state_dir = os.path.join(self.sdk_output, self.sdk_native_path, | ||
| 107 | self.d.getVar('localstatedir_nativesdk').strip('/'), | ||
| 108 | "lib", "opkg") | ||
| 109 | self.mkdirhier(native_opkg_state_dir) | ||
| 110 | for f in glob.glob(os.path.join(self.sdk_output, "var", "lib", "opkg", "*")): | ||
| 111 | self.movefile(f, native_opkg_state_dir) | ||
| 112 | |||
| 113 | self.remove(os.path.join(self.sdk_output, "var"), True) | ||
