diff options
Diffstat (limited to 'meta/lib/oe/sdk.py')
-rw-r--r-- | meta/lib/oe/sdk.py | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/meta/lib/oe/sdk.py b/meta/lib/oe/sdk.py index c74525f929..fef02d0777 100644 --- a/meta/lib/oe/sdk.py +++ b/meta/lib/oe/sdk.py | |||
@@ -11,16 +11,16 @@ import traceback | |||
11 | class Sdk(object, metaclass=ABCMeta): | 11 | class Sdk(object, metaclass=ABCMeta): |
12 | def __init__(self, d, manifest_dir): | 12 | def __init__(self, d, manifest_dir): |
13 | self.d = d | 13 | self.d = d |
14 | self.sdk_output = self.d.getVar('SDK_OUTPUT', True) | 14 | self.sdk_output = self.d.getVar('SDK_OUTPUT') |
15 | self.sdk_native_path = self.d.getVar('SDKPATHNATIVE', True).strip('/') | 15 | self.sdk_native_path = self.d.getVar('SDKPATHNATIVE').strip('/') |
16 | self.target_path = self.d.getVar('SDKTARGETSYSROOT', True).strip('/') | 16 | self.target_path = self.d.getVar('SDKTARGETSYSROOT').strip('/') |
17 | self.sysconfdir = self.d.getVar('sysconfdir', True).strip('/') | 17 | self.sysconfdir = self.d.getVar('sysconfdir').strip('/') |
18 | 18 | ||
19 | self.sdk_target_sysroot = os.path.join(self.sdk_output, self.target_path) | 19 | self.sdk_target_sysroot = os.path.join(self.sdk_output, self.target_path) |
20 | self.sdk_host_sysroot = self.sdk_output | 20 | self.sdk_host_sysroot = self.sdk_output |
21 | 21 | ||
22 | if manifest_dir is None: | 22 | if manifest_dir is None: |
23 | self.manifest_dir = self.d.getVar("SDK_DIR", True) | 23 | self.manifest_dir = self.d.getVar("SDK_DIR") |
24 | else: | 24 | else: |
25 | self.manifest_dir = manifest_dir | 25 | self.manifest_dir = manifest_dir |
26 | 26 | ||
@@ -40,12 +40,12 @@ class Sdk(object, metaclass=ABCMeta): | |||
40 | 40 | ||
41 | # Don't ship any libGL in the SDK | 41 | # Don't ship any libGL in the SDK |
42 | self.remove(os.path.join(self.sdk_output, self.sdk_native_path, | 42 | self.remove(os.path.join(self.sdk_output, self.sdk_native_path, |
43 | self.d.getVar('libdir_nativesdk', True).strip('/'), | 43 | self.d.getVar('libdir_nativesdk').strip('/'), |
44 | "libGL*")) | 44 | "libGL*")) |
45 | 45 | ||
46 | # Fix or remove broken .la files | 46 | # Fix or remove broken .la files |
47 | self.remove(os.path.join(self.sdk_output, self.sdk_native_path, | 47 | self.remove(os.path.join(self.sdk_output, self.sdk_native_path, |
48 | self.d.getVar('libdir_nativesdk', True).strip('/'), | 48 | self.d.getVar('libdir_nativesdk').strip('/'), |
49 | "*.la")) | 49 | "*.la")) |
50 | 50 | ||
51 | # Link the ld.so.cache file into the hosts filesystem | 51 | # Link the ld.so.cache file into the hosts filesystem |
@@ -54,7 +54,7 @@ class Sdk(object, metaclass=ABCMeta): | |||
54 | self.mkdirhier(os.path.dirname(link_name)) | 54 | self.mkdirhier(os.path.dirname(link_name)) |
55 | os.symlink("/etc/ld.so.cache", link_name) | 55 | os.symlink("/etc/ld.so.cache", link_name) |
56 | 56 | ||
57 | execute_pre_post_process(self.d, self.d.getVar('SDK_POSTPROCESS_COMMAND', True)) | 57 | execute_pre_post_process(self.d, self.d.getVar('SDK_POSTPROCESS_COMMAND')) |
58 | 58 | ||
59 | def movefile(self, sourcefile, destdir): | 59 | def movefile(self, sourcefile, destdir): |
60 | try: | 60 | try: |
@@ -102,7 +102,7 @@ class RpmSdk(Sdk): | |||
102 | 102 | ||
103 | self.target_pm = RpmPM(d, | 103 | self.target_pm = RpmPM(d, |
104 | self.sdk_target_sysroot, | 104 | self.sdk_target_sysroot, |
105 | self.d.getVar('TARGET_VENDOR', True), | 105 | self.d.getVar('TARGET_VENDOR'), |
106 | 'target', | 106 | 'target', |
107 | target_providename | 107 | target_providename |
108 | ) | 108 | ) |
@@ -118,7 +118,7 @@ class RpmSdk(Sdk): | |||
118 | 118 | ||
119 | self.host_pm = RpmPM(d, | 119 | self.host_pm = RpmPM(d, |
120 | self.sdk_host_sysroot, | 120 | self.sdk_host_sysroot, |
121 | self.d.getVar('SDK_VENDOR', True), | 121 | self.d.getVar('SDK_VENDOR'), |
122 | 'host', | 122 | 'host', |
123 | sdk_providename, | 123 | sdk_providename, |
124 | "SDK_PACKAGE_ARCHS", | 124 | "SDK_PACKAGE_ARCHS", |
@@ -149,9 +149,9 @@ class RpmSdk(Sdk): | |||
149 | bb.note("Installing TARGET packages") | 149 | bb.note("Installing TARGET packages") |
150 | self._populate_sysroot(self.target_pm, self.target_manifest) | 150 | self._populate_sysroot(self.target_pm, self.target_manifest) |
151 | 151 | ||
152 | self.target_pm.install_complementary(self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY', True)) | 152 | self.target_pm.install_complementary(self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY')) |
153 | 153 | ||
154 | execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_TARGET_COMMAND", True)) | 154 | execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_TARGET_COMMAND")) |
155 | 155 | ||
156 | if not bb.utils.contains("SDKIMAGE_FEATURES", "package-management", True, False, self.d): | 156 | if not bb.utils.contains("SDKIMAGE_FEATURES", "package-management", True, False, self.d): |
157 | self.target_pm.remove_packaging_data() | 157 | self.target_pm.remove_packaging_data() |
@@ -159,7 +159,7 @@ class RpmSdk(Sdk): | |||
159 | bb.note("Installing NATIVESDK packages") | 159 | bb.note("Installing NATIVESDK packages") |
160 | self._populate_sysroot(self.host_pm, self.host_manifest) | 160 | self._populate_sysroot(self.host_pm, self.host_manifest) |
161 | 161 | ||
162 | execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_HOST_COMMAND", True)) | 162 | execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_HOST_COMMAND")) |
163 | 163 | ||
164 | if not bb.utils.contains("SDKIMAGE_FEATURES", "package-management", True, False, self.d): | 164 | if not bb.utils.contains("SDKIMAGE_FEATURES", "package-management", True, False, self.d): |
165 | self.host_pm.remove_packaging_data() | 165 | self.host_pm.remove_packaging_data() |
@@ -167,7 +167,7 @@ class RpmSdk(Sdk): | |||
167 | # Move host RPM library data | 167 | # Move host RPM library data |
168 | native_rpm_state_dir = os.path.join(self.sdk_output, | 168 | native_rpm_state_dir = os.path.join(self.sdk_output, |
169 | self.sdk_native_path, | 169 | self.sdk_native_path, |
170 | self.d.getVar('localstatedir_nativesdk', True).strip('/'), | 170 | self.d.getVar('localstatedir_nativesdk').strip('/'), |
171 | "lib", | 171 | "lib", |
172 | "rpm" | 172 | "rpm" |
173 | ) | 173 | ) |
@@ -197,8 +197,8 @@ class OpkgSdk(Sdk): | |||
197 | def __init__(self, d, manifest_dir=None): | 197 | def __init__(self, d, manifest_dir=None): |
198 | super(OpkgSdk, self).__init__(d, manifest_dir) | 198 | super(OpkgSdk, self).__init__(d, manifest_dir) |
199 | 199 | ||
200 | self.target_conf = self.d.getVar("IPKGCONF_TARGET", True) | 200 | self.target_conf = self.d.getVar("IPKGCONF_TARGET") |
201 | self.host_conf = self.d.getVar("IPKGCONF_SDK", True) | 201 | self.host_conf = self.d.getVar("IPKGCONF_SDK") |
202 | 202 | ||
203 | self.target_manifest = OpkgManifest(d, self.manifest_dir, | 203 | self.target_manifest = OpkgManifest(d, self.manifest_dir, |
204 | Manifest.MANIFEST_TYPE_SDK_TARGET) | 204 | Manifest.MANIFEST_TYPE_SDK_TARGET) |
@@ -206,15 +206,15 @@ class OpkgSdk(Sdk): | |||
206 | Manifest.MANIFEST_TYPE_SDK_HOST) | 206 | Manifest.MANIFEST_TYPE_SDK_HOST) |
207 | 207 | ||
208 | self.target_pm = OpkgPM(d, self.sdk_target_sysroot, self.target_conf, | 208 | self.target_pm = OpkgPM(d, self.sdk_target_sysroot, self.target_conf, |
209 | self.d.getVar("ALL_MULTILIB_PACKAGE_ARCHS", True)) | 209 | self.d.getVar("ALL_MULTILIB_PACKAGE_ARCHS")) |
210 | 210 | ||
211 | self.host_pm = OpkgPM(d, self.sdk_host_sysroot, self.host_conf, | 211 | self.host_pm = OpkgPM(d, self.sdk_host_sysroot, self.host_conf, |
212 | self.d.getVar("SDK_PACKAGE_ARCHS", True)) | 212 | self.d.getVar("SDK_PACKAGE_ARCHS")) |
213 | 213 | ||
214 | def _populate_sysroot(self, pm, manifest): | 214 | def _populate_sysroot(self, pm, manifest): |
215 | pkgs_to_install = manifest.parse_initial_manifest() | 215 | pkgs_to_install = manifest.parse_initial_manifest() |
216 | 216 | ||
217 | if (self.d.getVar('BUILD_IMAGES_FROM_FEEDS', True) or "") != "1": | 217 | if (self.d.getVar('BUILD_IMAGES_FROM_FEEDS') or "") != "1": |
218 | pm.write_index() | 218 | pm.write_index() |
219 | 219 | ||
220 | pm.update() | 220 | pm.update() |
@@ -228,9 +228,9 @@ class OpkgSdk(Sdk): | |||
228 | bb.note("Installing TARGET packages") | 228 | bb.note("Installing TARGET packages") |
229 | self._populate_sysroot(self.target_pm, self.target_manifest) | 229 | self._populate_sysroot(self.target_pm, self.target_manifest) |
230 | 230 | ||
231 | self.target_pm.install_complementary(self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY', True)) | 231 | self.target_pm.install_complementary(self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY')) |
232 | 232 | ||
233 | execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_TARGET_COMMAND", True)) | 233 | execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_TARGET_COMMAND")) |
234 | 234 | ||
235 | if not bb.utils.contains("SDKIMAGE_FEATURES", "package-management", True, False, self.d): | 235 | if not bb.utils.contains("SDKIMAGE_FEATURES", "package-management", True, False, self.d): |
236 | self.target_pm.remove_packaging_data() | 236 | self.target_pm.remove_packaging_data() |
@@ -238,7 +238,7 @@ class OpkgSdk(Sdk): | |||
238 | bb.note("Installing NATIVESDK packages") | 238 | bb.note("Installing NATIVESDK packages") |
239 | self._populate_sysroot(self.host_pm, self.host_manifest) | 239 | self._populate_sysroot(self.host_pm, self.host_manifest) |
240 | 240 | ||
241 | execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_HOST_COMMAND", True)) | 241 | execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_HOST_COMMAND")) |
242 | 242 | ||
243 | if not bb.utils.contains("SDKIMAGE_FEATURES", "package-management", True, False, self.d): | 243 | if not bb.utils.contains("SDKIMAGE_FEATURES", "package-management", True, False, self.d): |
244 | self.host_pm.remove_packaging_data() | 244 | self.host_pm.remove_packaging_data() |
@@ -257,7 +257,7 @@ class OpkgSdk(Sdk): | |||
257 | os.path.basename(self.host_conf)), 0o644) | 257 | os.path.basename(self.host_conf)), 0o644) |
258 | 258 | ||
259 | native_opkg_state_dir = os.path.join(self.sdk_output, self.sdk_native_path, | 259 | native_opkg_state_dir = os.path.join(self.sdk_output, self.sdk_native_path, |
260 | self.d.getVar('localstatedir_nativesdk', True).strip('/'), | 260 | self.d.getVar('localstatedir_nativesdk').strip('/'), |
261 | "lib", "opkg") | 261 | "lib", "opkg") |
262 | self.mkdirhier(native_opkg_state_dir) | 262 | self.mkdirhier(native_opkg_state_dir) |
263 | for f in glob.glob(os.path.join(self.sdk_output, "var", "lib", "opkg", "*")): | 263 | for f in glob.glob(os.path.join(self.sdk_output, "var", "lib", "opkg", "*")): |
@@ -270,8 +270,8 @@ class DpkgSdk(Sdk): | |||
270 | def __init__(self, d, manifest_dir=None): | 270 | def __init__(self, d, manifest_dir=None): |
271 | super(DpkgSdk, self).__init__(d, manifest_dir) | 271 | super(DpkgSdk, self).__init__(d, manifest_dir) |
272 | 272 | ||
273 | self.target_conf_dir = os.path.join(self.d.getVar("APTCONF_TARGET", True), "apt") | 273 | self.target_conf_dir = os.path.join(self.d.getVar("APTCONF_TARGET"), "apt") |
274 | self.host_conf_dir = os.path.join(self.d.getVar("APTCONF_TARGET", True), "apt-sdk") | 274 | self.host_conf_dir = os.path.join(self.d.getVar("APTCONF_TARGET"), "apt-sdk") |
275 | 275 | ||
276 | self.target_manifest = DpkgManifest(d, self.manifest_dir, | 276 | self.target_manifest = DpkgManifest(d, self.manifest_dir, |
277 | Manifest.MANIFEST_TYPE_SDK_TARGET) | 277 | Manifest.MANIFEST_TYPE_SDK_TARGET) |
@@ -279,17 +279,17 @@ class DpkgSdk(Sdk): | |||
279 | Manifest.MANIFEST_TYPE_SDK_HOST) | 279 | Manifest.MANIFEST_TYPE_SDK_HOST) |
280 | 280 | ||
281 | self.target_pm = DpkgPM(d, self.sdk_target_sysroot, | 281 | self.target_pm = DpkgPM(d, self.sdk_target_sysroot, |
282 | self.d.getVar("PACKAGE_ARCHS", True), | 282 | self.d.getVar("PACKAGE_ARCHS"), |
283 | self.d.getVar("DPKG_ARCH", True), | 283 | self.d.getVar("DPKG_ARCH"), |
284 | self.target_conf_dir) | 284 | self.target_conf_dir) |
285 | 285 | ||
286 | self.host_pm = DpkgPM(d, self.sdk_host_sysroot, | 286 | self.host_pm = DpkgPM(d, self.sdk_host_sysroot, |
287 | self.d.getVar("SDK_PACKAGE_ARCHS", True), | 287 | self.d.getVar("SDK_PACKAGE_ARCHS"), |
288 | self.d.getVar("DEB_SDK_ARCH", True), | 288 | self.d.getVar("DEB_SDK_ARCH"), |
289 | self.host_conf_dir) | 289 | self.host_conf_dir) |
290 | 290 | ||
291 | def _copy_apt_dir_to(self, dst_dir): | 291 | def _copy_apt_dir_to(self, dst_dir): |
292 | staging_etcdir_native = self.d.getVar("STAGING_ETCDIR_NATIVE", True) | 292 | staging_etcdir_native = self.d.getVar("STAGING_ETCDIR_NATIVE") |
293 | 293 | ||
294 | self.remove(dst_dir, True) | 294 | self.remove(dst_dir, True) |
295 | 295 | ||
@@ -310,9 +310,9 @@ class DpkgSdk(Sdk): | |||
310 | bb.note("Installing TARGET packages") | 310 | bb.note("Installing TARGET packages") |
311 | self._populate_sysroot(self.target_pm, self.target_manifest) | 311 | self._populate_sysroot(self.target_pm, self.target_manifest) |
312 | 312 | ||
313 | self.target_pm.install_complementary(self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY', True)) | 313 | self.target_pm.install_complementary(self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY')) |
314 | 314 | ||
315 | execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_TARGET_COMMAND", True)) | 315 | execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_TARGET_COMMAND")) |
316 | 316 | ||
317 | self._copy_apt_dir_to(os.path.join(self.sdk_target_sysroot, "etc", "apt")) | 317 | self._copy_apt_dir_to(os.path.join(self.sdk_target_sysroot, "etc", "apt")) |
318 | 318 | ||
@@ -322,7 +322,7 @@ class DpkgSdk(Sdk): | |||
322 | bb.note("Installing NATIVESDK packages") | 322 | bb.note("Installing NATIVESDK packages") |
323 | self._populate_sysroot(self.host_pm, self.host_manifest) | 323 | self._populate_sysroot(self.host_pm, self.host_manifest) |
324 | 324 | ||
325 | execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_HOST_COMMAND", True)) | 325 | execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_HOST_COMMAND")) |
326 | 326 | ||
327 | self._copy_apt_dir_to(os.path.join(self.sdk_output, self.sdk_native_path, | 327 | self._copy_apt_dir_to(os.path.join(self.sdk_output, self.sdk_native_path, |
328 | "etc", "apt")) | 328 | "etc", "apt")) |
@@ -341,26 +341,26 @@ class DpkgSdk(Sdk): | |||
341 | 341 | ||
342 | def sdk_list_installed_packages(d, target, rootfs_dir=None): | 342 | def sdk_list_installed_packages(d, target, rootfs_dir=None): |
343 | if rootfs_dir is None: | 343 | if rootfs_dir is None: |
344 | sdk_output = d.getVar('SDK_OUTPUT', True) | 344 | sdk_output = d.getVar('SDK_OUTPUT') |
345 | target_path = d.getVar('SDKTARGETSYSROOT', True).strip('/') | 345 | target_path = d.getVar('SDKTARGETSYSROOT').strip('/') |
346 | 346 | ||
347 | rootfs_dir = [sdk_output, os.path.join(sdk_output, target_path)][target is True] | 347 | rootfs_dir = [sdk_output, os.path.join(sdk_output, target_path)][target is True] |
348 | 348 | ||
349 | img_type = d.getVar('IMAGE_PKGTYPE', True) | 349 | img_type = d.getVar('IMAGE_PKGTYPE') |
350 | if img_type == "rpm": | 350 | if img_type == "rpm": |
351 | arch_var = ["SDK_PACKAGE_ARCHS", None][target is True] | 351 | arch_var = ["SDK_PACKAGE_ARCHS", None][target is True] |
352 | os_var = ["SDK_OS", None][target is True] | 352 | os_var = ["SDK_OS", None][target is True] |
353 | return RpmPkgsList(d, rootfs_dir, arch_var, os_var).list_pkgs() | 353 | return RpmPkgsList(d, rootfs_dir, arch_var, os_var).list_pkgs() |
354 | elif img_type == "ipk": | 354 | elif img_type == "ipk": |
355 | conf_file_var = ["IPKGCONF_SDK", "IPKGCONF_TARGET"][target is True] | 355 | conf_file_var = ["IPKGCONF_SDK", "IPKGCONF_TARGET"][target is True] |
356 | return OpkgPkgsList(d, rootfs_dir, d.getVar(conf_file_var, True)).list_pkgs() | 356 | return OpkgPkgsList(d, rootfs_dir, d.getVar(conf_file_var)).list_pkgs() |
357 | elif img_type == "deb": | 357 | elif img_type == "deb": |
358 | return DpkgPkgsList(d, rootfs_dir).list_pkgs() | 358 | return DpkgPkgsList(d, rootfs_dir).list_pkgs() |
359 | 359 | ||
360 | def populate_sdk(d, manifest_dir=None): | 360 | def populate_sdk(d, manifest_dir=None): |
361 | env_bkp = os.environ.copy() | 361 | env_bkp = os.environ.copy() |
362 | 362 | ||
363 | img_type = d.getVar('IMAGE_PKGTYPE', True) | 363 | img_type = d.getVar('IMAGE_PKGTYPE') |
364 | if img_type == "rpm": | 364 | if img_type == "rpm": |
365 | RpmSdk(d, manifest_dir).populate() | 365 | RpmSdk(d, manifest_dir).populate() |
366 | elif img_type == "ipk": | 366 | elif img_type == "ipk": |