diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-10 14:35:29 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-12 15:27:17 +0100 |
commit | fd1517e2b51a170f2427122c6b95396db251d827 (patch) | |
tree | dabfe3e631339c2fc99a9ee7febb0f9c128e325e /meta/classes-recipe/populate_sdk_base.bbclass | |
parent | 10317912ee319ccf7f83605d438b5cbf9663f296 (diff) | |
download | poky-fd1517e2b51a170f2427122c6b95396db251d827.tar.gz |
classes: Update classes to match new bitbake class scope functionality
Move classes to classes-global or classes-recipe as appropriate to take
advantage of new bitbake functionality to check class scope/usage.
(From OE-Core rev: f5c128008365e141082c129417eb72d2751e8045)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe/populate_sdk_base.bbclass')
-rw-r--r-- | meta/classes-recipe/populate_sdk_base.bbclass | 384 |
1 files changed, 384 insertions, 0 deletions
diff --git a/meta/classes-recipe/populate_sdk_base.bbclass b/meta/classes-recipe/populate_sdk_base.bbclass new file mode 100644 index 0000000000..0be108ad98 --- /dev/null +++ b/meta/classes-recipe/populate_sdk_base.bbclass | |||
@@ -0,0 +1,384 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | PACKAGES = "" | ||
8 | |||
9 | inherit image-postinst-intercepts image-artifact-names | ||
10 | |||
11 | # Wildcards specifying complementary packages to install for every package that has been explicitly | ||
12 | # installed into the rootfs | ||
13 | COMPLEMENTARY_GLOB[dev-pkgs] = '*-dev' | ||
14 | COMPLEMENTARY_GLOB[staticdev-pkgs] = '*-staticdev' | ||
15 | COMPLEMENTARY_GLOB[doc-pkgs] = '*-doc' | ||
16 | COMPLEMENTARY_GLOB[dbg-pkgs] = '*-dbg' | ||
17 | COMPLEMENTARY_GLOB[src-pkgs] = '*-src' | ||
18 | COMPLEMENTARY_GLOB[ptest-pkgs] = '*-ptest' | ||
19 | COMPLEMENTARY_GLOB[bash-completion-pkgs] = '*-bash-completion' | ||
20 | |||
21 | def complementary_globs(featurevar, d): | ||
22 | all_globs = d.getVarFlags('COMPLEMENTARY_GLOB') | ||
23 | globs = [] | ||
24 | features = set((d.getVar(featurevar) or '').split()) | ||
25 | for name, glob in all_globs.items(): | ||
26 | if name in features: | ||
27 | globs.append(glob) | ||
28 | return ' '.join(globs) | ||
29 | |||
30 | SDKIMAGE_FEATURES ??= "dev-pkgs dbg-pkgs src-pkgs ${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'doc-pkgs', '', d)}" | ||
31 | SDKIMAGE_INSTALL_COMPLEMENTARY = '${@complementary_globs("SDKIMAGE_FEATURES", d)}' | ||
32 | SDKIMAGE_INSTALL_COMPLEMENTARY[vardeps] += "SDKIMAGE_FEATURES" | ||
33 | |||
34 | PACKAGE_ARCHS:append:task-populate-sdk = " sdk-provides-dummy-target" | ||
35 | SDK_PACKAGE_ARCHS += "sdk-provides-dummy-${SDKPKGSUFFIX}" | ||
36 | |||
37 | # List of locales to install, or "all" for all of them, or unset for none. | ||
38 | SDKIMAGE_LINGUAS ?= "all" | ||
39 | |||
40 | inherit rootfs_${IMAGE_PKGTYPE} | ||
41 | |||
42 | SDK_DIR = "${WORKDIR}/sdk" | ||
43 | SDK_OUTPUT = "${SDK_DIR}/image" | ||
44 | SDK_DEPLOY = "${DEPLOY_DIR}/sdk" | ||
45 | |||
46 | SDKDEPLOYDIR = "${WORKDIR}/${SDKMACHINE}-deploy-${PN}-populate-sdk" | ||
47 | |||
48 | B:task-populate-sdk = "${SDK_DIR}" | ||
49 | |||
50 | SDKTARGETSYSROOT = "${SDKPATH}/sysroots/${REAL_MULTIMACH_TARGET_SYS}" | ||
51 | |||
52 | SDK_TOOLCHAIN_LANGS ??= "" | ||
53 | SDK_TOOLCHAIN_LANGS:remove:sdkmingw32 = "rust" | ||
54 | # libstd-rs doesn't build for mips n32 with compiler constraint errors | ||
55 | SDK_TOOLCHAIN_LANGS:remove:mipsarchn32 = "rust" | ||
56 | |||
57 | TOOLCHAIN_HOST_TASK ?= " \ | ||
58 | nativesdk-packagegroup-sdk-host \ | ||
59 | packagegroup-cross-canadian-${MACHINE} \ | ||
60 | ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'go', 'packagegroup-go-cross-canadian-${MACHINE}', '', d)} \ | ||
61 | ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'rust', 'packagegroup-rust-cross-canadian-${MACHINE}', '', d)} \ | ||
62 | " | ||
63 | TOOLCHAIN_HOST_TASK_ATTEMPTONLY ?= "" | ||
64 | TOOLCHAIN_TARGET_TASK ?= " \ | ||
65 | ${@multilib_pkg_extend(d, 'packagegroup-core-standalone-sdk-target')} \ | ||
66 | ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'go', multilib_pkg_extend(d, 'packagegroup-go-sdk-target'), '', d)} \ | ||
67 | ${@bb.utils.contains('SDK_TOOLCHAIN_LANGS', 'rust', multilib_pkg_extend(d, 'libstd-rs'), '', d)} \ | ||
68 | target-sdk-provides-dummy \ | ||
69 | " | ||
70 | TOOLCHAIN_TARGET_TASK_ATTEMPTONLY ?= "" | ||
71 | TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-toolchain-${SDK_VERSION}" | ||
72 | |||
73 | # Default archived SDK's suffix | ||
74 | SDK_ARCHIVE_TYPE ?= "tar.xz" | ||
75 | SDK_XZ_COMPRESSION_LEVEL ?= "-9" | ||
76 | SDK_XZ_OPTIONS ?= "${XZ_DEFAULTS} ${SDK_XZ_COMPRESSION_LEVEL}" | ||
77 | |||
78 | # To support different sdk type according to SDK_ARCHIVE_TYPE, now support zip and tar.xz | ||
79 | python () { | ||
80 | if d.getVar('SDK_ARCHIVE_TYPE') == 'zip': | ||
81 | d.setVar('SDK_ARCHIVE_DEPENDS', 'zip-native') | ||
82 | # SDK_ARCHIVE_CMD used to generate archived sdk ${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} from input dir ${SDK_OUTPUT}/${SDKPATH} to output dir ${SDKDEPLOYDIR} | ||
83 | # recommand to cd into input dir first to avoid archive with buildpath | ||
84 | d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; zip -r -y ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} .') | ||
85 | else: | ||
86 | d.setVar('SDK_ARCHIVE_DEPENDS', 'xz-native') | ||
87 | d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; tar ${SDKTAROPTS} -cf - . | xz ${SDK_XZ_OPTIONS} > ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE}') | ||
88 | } | ||
89 | |||
90 | SDK_RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}" | ||
91 | SDK_DEPENDS = "virtual/fakeroot-native ${SDK_ARCHIVE_DEPENDS} cross-localedef-native nativesdk-qemuwrapper-cross ${@' '.join(["%s-qemuwrapper-cross" % m for m in d.getVar("MULTILIB_VARIANTS").split()])} qemuwrapper-cross" | ||
92 | PATH:prepend = "${WORKDIR}/recipe-sysroot/${SDKPATHNATIVE}${bindir}/crossscripts:${@":".join(all_multilib_tune_values(d, 'STAGING_BINDIR_CROSS').split())}:" | ||
93 | SDK_DEPENDS += "nativesdk-glibc-locale" | ||
94 | |||
95 | # We want the MULTIARCH_TARGET_SYS to point to the TUNE_PKGARCH, not PACKAGE_ARCH as it | ||
96 | # could be set to the MACHINE_ARCH | ||
97 | REAL_MULTIMACH_TARGET_SYS = "${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}" | ||
98 | |||
99 | PID = "${@os.getpid()}" | ||
100 | |||
101 | EXCLUDE_FROM_WORLD = "1" | ||
102 | |||
103 | SDK_PACKAGING_FUNC ?= "create_shar" | ||
104 | SDK_PRE_INSTALL_COMMAND ?= "" | ||
105 | SDK_POST_INSTALL_COMMAND ?= "" | ||
106 | SDK_RELOCATE_AFTER_INSTALL ?= "1" | ||
107 | |||
108 | SDKEXTPATH ??= "~/${@d.getVar('DISTRO')}_sdk" | ||
109 | SDK_TITLE ??= "${@d.getVar('DISTRO_NAME') or d.getVar('DISTRO')} SDK" | ||
110 | |||
111 | SDK_TARGET_MANIFEST = "${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.target.manifest" | ||
112 | SDK_HOST_MANIFEST = "${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.host.manifest" | ||
113 | SDK_EXT_TARGET_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.target.manifest" | ||
114 | SDK_EXT_HOST_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.host.manifest" | ||
115 | |||
116 | SDK_PRUNE_SYSROOT_DIRS ?= "/dev" | ||
117 | |||
118 | python write_target_sdk_manifest () { | ||
119 | from oe.sdk import sdk_list_installed_packages | ||
120 | from oe.utils import format_pkg_list | ||
121 | sdkmanifestdir = os.path.dirname(d.getVar("SDK_TARGET_MANIFEST")) | ||
122 | pkgs = sdk_list_installed_packages(d, True) | ||
123 | if not os.path.exists(sdkmanifestdir): | ||
124 | bb.utils.mkdirhier(sdkmanifestdir) | ||
125 | with open(d.getVar('SDK_TARGET_MANIFEST'), 'w') as output: | ||
126 | output.write(format_pkg_list(pkgs, 'ver')) | ||
127 | } | ||
128 | |||
129 | sdk_prune_dirs () { | ||
130 | for d in ${SDK_PRUNE_SYSROOT_DIRS}; do | ||
131 | rm -rf ${SDK_OUTPUT}${SDKTARGETSYSROOT}$d | ||
132 | done | ||
133 | } | ||
134 | |||
135 | python write_sdk_test_data() { | ||
136 | from oe.data import export2json | ||
137 | testdata = "%s/%s.testdata.json" % (d.getVar('SDKDEPLOYDIR'), d.getVar('TOOLCHAIN_OUTPUTNAME')) | ||
138 | bb.utils.mkdirhier(os.path.dirname(testdata)) | ||
139 | export2json(d, testdata) | ||
140 | } | ||
141 | |||
142 | python write_host_sdk_manifest () { | ||
143 | from oe.sdk import sdk_list_installed_packages | ||
144 | from oe.utils import format_pkg_list | ||
145 | sdkmanifestdir = os.path.dirname(d.getVar("SDK_HOST_MANIFEST")) | ||
146 | pkgs = sdk_list_installed_packages(d, False) | ||
147 | if not os.path.exists(sdkmanifestdir): | ||
148 | bb.utils.mkdirhier(sdkmanifestdir) | ||
149 | with open(d.getVar('SDK_HOST_MANIFEST'), 'w') as output: | ||
150 | output.write(format_pkg_list(pkgs, 'ver')) | ||
151 | } | ||
152 | |||
153 | POPULATE_SDK_POST_TARGET_COMMAND:append = " write_sdk_test_data ; " | ||
154 | POPULATE_SDK_POST_TARGET_COMMAND:append:task-populate-sdk = " write_target_sdk_manifest; sdk_prune_dirs; " | ||
155 | POPULATE_SDK_POST_HOST_COMMAND:append:task-populate-sdk = " write_host_sdk_manifest; " | ||
156 | |||
157 | SDK_PACKAGING_COMMAND = "${@'${SDK_PACKAGING_FUNC};' if '${SDK_PACKAGING_FUNC}' else ''}" | ||
158 | SDK_POSTPROCESS_COMMAND = " create_sdk_files; check_sdk_sysroots; archive_sdk; ${SDK_PACKAGING_COMMAND} " | ||
159 | |||
160 | def populate_sdk_common(d): | ||
161 | from oe.sdk import populate_sdk | ||
162 | from oe.manifest import create_manifest, Manifest | ||
163 | |||
164 | # Handle package exclusions | ||
165 | excl_pkgs = (d.getVar("PACKAGE_EXCLUDE") or "").split() | ||
166 | inst_pkgs = (d.getVar("PACKAGE_INSTALL") or "").split() | ||
167 | inst_attempt_pkgs = (d.getVar("PACKAGE_INSTALL_ATTEMPTONLY") or "").split() | ||
168 | |||
169 | d.setVar('PACKAGE_INSTALL_ORIG', ' '.join(inst_pkgs)) | ||
170 | d.setVar('PACKAGE_INSTALL_ATTEMPTONLY', ' '.join(inst_attempt_pkgs)) | ||
171 | |||
172 | for pkg in excl_pkgs: | ||
173 | if pkg in inst_pkgs: | ||
174 | bb.warn("Package %s, set to be excluded, is in %s PACKAGE_INSTALL (%s). It will be removed from the list." % (pkg, d.getVar('PN'), inst_pkgs)) | ||
175 | inst_pkgs.remove(pkg) | ||
176 | |||
177 | if pkg in inst_attempt_pkgs: | ||
178 | bb.warn("Package %s, set to be excluded, is in %s PACKAGE_INSTALL_ATTEMPTONLY (%s). It will be removed from the list." % (pkg, d.getVar('PN'), inst_pkgs)) | ||
179 | inst_attempt_pkgs.remove(pkg) | ||
180 | |||
181 | d.setVar("PACKAGE_INSTALL", ' '.join(inst_pkgs)) | ||
182 | d.setVar("PACKAGE_INSTALL_ATTEMPTONLY", ' '.join(inst_attempt_pkgs)) | ||
183 | |||
184 | pn = d.getVar('PN') | ||
185 | runtime_mapping_rename("TOOLCHAIN_TARGET_TASK", pn, d) | ||
186 | runtime_mapping_rename("TOOLCHAIN_TARGET_TASK_ATTEMPTONLY", pn, d) | ||
187 | |||
188 | ld = bb.data.createCopy(d) | ||
189 | ld.setVar("PKGDATA_DIR", "${STAGING_DIR}/${SDK_ARCH}-${SDKPKGSUFFIX}${SDK_VENDOR}-${SDK_OS}/pkgdata") | ||
190 | runtime_mapping_rename("TOOLCHAIN_HOST_TASK", pn, ld) | ||
191 | runtime_mapping_rename("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", pn, ld) | ||
192 | d.setVar("TOOLCHAIN_HOST_TASK", ld.getVar("TOOLCHAIN_HOST_TASK")) | ||
193 | d.setVar("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", ld.getVar("TOOLCHAIN_HOST_TASK_ATTEMPTONLY")) | ||
194 | |||
195 | # create target/host SDK manifests | ||
196 | create_manifest(d, manifest_dir=d.getVar('SDK_DIR'), | ||
197 | manifest_type=Manifest.MANIFEST_TYPE_SDK_HOST) | ||
198 | create_manifest(d, manifest_dir=d.getVar('SDK_DIR'), | ||
199 | manifest_type=Manifest.MANIFEST_TYPE_SDK_TARGET) | ||
200 | |||
201 | populate_sdk(d) | ||
202 | |||
203 | fakeroot python do_populate_sdk() { | ||
204 | populate_sdk_common(d) | ||
205 | } | ||
206 | SSTATETASKS += "do_populate_sdk" | ||
207 | SSTATE_SKIP_CREATION:task-populate-sdk = '1' | ||
208 | do_populate_sdk[cleandirs] = "${SDKDEPLOYDIR}" | ||
209 | do_populate_sdk[sstate-inputdirs] = "${SDKDEPLOYDIR}" | ||
210 | do_populate_sdk[sstate-outputdirs] = "${SDK_DEPLOY}" | ||
211 | do_populate_sdk[stamp-extra-info] = "${MACHINE_ARCH}${SDKMACHINE}" | ||
212 | python do_populate_sdk_setscene () { | ||
213 | sstate_setscene(d) | ||
214 | } | ||
215 | addtask do_populate_sdk_setscene | ||
216 | |||
217 | PSEUDO_IGNORE_PATHS .= ",${SDKDEPLOYDIR},${WORKDIR}/oe-sdk-repo,${WORKDIR}/sstate-build-populate_sdk" | ||
218 | |||
219 | fakeroot create_sdk_files() { | ||
220 | cp ${COREBASE}/scripts/relocate_sdk.py ${SDK_OUTPUT}/${SDKPATH}/ | ||
221 | |||
222 | # Replace the ##DEFAULT_INSTALL_DIR## with the correct pattern. | ||
223 | # Escape special characters like '+' and '.' in the SDKPATH | ||
224 | escaped_sdkpath=$(echo ${SDKPATH} |sed -e "s:[\+\.]:\\\\\\\\\0:g") | ||
225 | sed -i -e "s:##DEFAULT_INSTALL_DIR##:$escaped_sdkpath:" ${SDK_OUTPUT}/${SDKPATH}/relocate_sdk.py | ||
226 | |||
227 | mkdir -p ${SDK_OUTPUT}/${SDKPATHNATIVE}${sysconfdir}/ | ||
228 | echo '${SDKPATHNATIVE}${libdir_nativesdk} | ||
229 | ${SDKPATHNATIVE}${base_libdir_nativesdk} | ||
230 | include /etc/ld.so.conf' > ${SDK_OUTPUT}/${SDKPATHNATIVE}${sysconfdir}/ld.so.conf | ||
231 | } | ||
232 | |||
233 | python check_sdk_sysroots() { | ||
234 | # Fails build if there are broken or dangling symlinks in SDK sysroots | ||
235 | |||
236 | if d.getVar('CHECK_SDK_SYSROOTS') != '1': | ||
237 | # disabled, bail out | ||
238 | return | ||
239 | |||
240 | def norm_path(path): | ||
241 | return os.path.abspath(path) | ||
242 | |||
243 | # Get scan root | ||
244 | SCAN_ROOT = norm_path("%s/%s/sysroots/" % (d.getVar('SDK_OUTPUT'), | ||
245 | d.getVar('SDKPATH'))) | ||
246 | |||
247 | bb.note('Checking SDK sysroots at ' + SCAN_ROOT) | ||
248 | |||
249 | def check_symlink(linkPath): | ||
250 | if not os.path.islink(linkPath): | ||
251 | return | ||
252 | |||
253 | linkDirPath = os.path.dirname(linkPath) | ||
254 | |||
255 | targetPath = os.readlink(linkPath) | ||
256 | if not os.path.isabs(targetPath): | ||
257 | targetPath = os.path.join(linkDirPath, targetPath) | ||
258 | targetPath = norm_path(targetPath) | ||
259 | |||
260 | if SCAN_ROOT != os.path.commonprefix( [SCAN_ROOT, targetPath] ): | ||
261 | bb.error("Escaping symlink {0!s} --> {1!s}".format(linkPath, targetPath)) | ||
262 | return | ||
263 | |||
264 | if not os.path.exists(targetPath): | ||
265 | bb.error("Broken symlink {0!s} --> {1!s}".format(linkPath, targetPath)) | ||
266 | return | ||
267 | |||
268 | if os.path.isdir(targetPath): | ||
269 | dir_walk(targetPath) | ||
270 | |||
271 | def walk_error_handler(e): | ||
272 | bb.error(str(e)) | ||
273 | |||
274 | def dir_walk(rootDir): | ||
275 | for dirPath,subDirEntries,fileEntries in os.walk(rootDir, followlinks=False, onerror=walk_error_handler): | ||
276 | entries = subDirEntries + fileEntries | ||
277 | for e in entries: | ||
278 | ePath = os.path.join(dirPath, e) | ||
279 | check_symlink(ePath) | ||
280 | |||
281 | # start | ||
282 | dir_walk(SCAN_ROOT) | ||
283 | } | ||
284 | |||
285 | SDKTAROPTS = "--owner=root --group=root" | ||
286 | |||
287 | fakeroot archive_sdk() { | ||
288 | # Package it up | ||
289 | mkdir -p ${SDKDEPLOYDIR} | ||
290 | ${SDK_ARCHIVE_CMD} | ||
291 | } | ||
292 | |||
293 | TOOLCHAIN_SHAR_EXT_TMPL ?= "${COREBASE}/meta/files/toolchain-shar-extract.sh" | ||
294 | TOOLCHAIN_SHAR_REL_TMPL ?= "${COREBASE}/meta/files/toolchain-shar-relocate.sh" | ||
295 | |||
296 | fakeroot create_shar() { | ||
297 | # copy in the template shar extractor script | ||
298 | cp ${TOOLCHAIN_SHAR_EXT_TMPL} ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh | ||
299 | |||
300 | rm -f ${T}/pre_install_command ${T}/post_install_command | ||
301 | |||
302 | if [ "${SDK_RELOCATE_AFTER_INSTALL}" = "1" ] ; then | ||
303 | cp ${TOOLCHAIN_SHAR_REL_TMPL} ${T}/post_install_command | ||
304 | fi | ||
305 | cat << "EOF" >> ${T}/pre_install_command | ||
306 | ${SDK_PRE_INSTALL_COMMAND} | ||
307 | EOF | ||
308 | |||
309 | cat << "EOF" >> ${T}/post_install_command | ||
310 | ${SDK_POST_INSTALL_COMMAND} | ||
311 | EOF | ||
312 | sed -i -e '/@SDK_PRE_INSTALL_COMMAND@/r ${T}/pre_install_command' \ | ||
313 | -e '/@SDK_POST_INSTALL_COMMAND@/r ${T}/post_install_command' \ | ||
314 | ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh | ||
315 | |||
316 | # substitute variables | ||
317 | sed -i -e 's#@SDK_ARCH@#${SDK_ARCH}#g' \ | ||
318 | -e 's#@SDKPATH@#${SDKPATH}#g' \ | ||
319 | -e 's#@SDKPATHINSTALL@#${SDKPATHINSTALL}#g' \ | ||
320 | -e 's#@SDKEXTPATH@#${SDKEXTPATH}#g' \ | ||
321 | -e 's#@OLDEST_KERNEL@#${SDK_OLDEST_KERNEL}#g' \ | ||
322 | -e 's#@REAL_MULTIMACH_TARGET_SYS@#${REAL_MULTIMACH_TARGET_SYS}#g' \ | ||
323 | -e 's#@SDK_TITLE@#${@d.getVar("SDK_TITLE").replace('&', '\\&')}#g' \ | ||
324 | -e 's#@SDK_VERSION@#${SDK_VERSION}#g' \ | ||
325 | -e '/@SDK_PRE_INSTALL_COMMAND@/d' \ | ||
326 | -e '/@SDK_POST_INSTALL_COMMAND@/d' \ | ||
327 | -e 's#@SDK_GCC_VER@#${@oe.utils.host_gcc_version(d, taskcontextonly=True)}#g' \ | ||
328 | -e 's#@SDK_ARCHIVE_TYPE@#${SDK_ARCHIVE_TYPE}#g' \ | ||
329 | ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh | ||
330 | |||
331 | # add execution permission | ||
332 | chmod +x ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh | ||
333 | |||
334 | # append the SDK tarball | ||
335 | cat ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} >> ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh | ||
336 | |||
337 | # delete the old tarball, we don't need it anymore | ||
338 | rm ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} | ||
339 | } | ||
340 | |||
341 | populate_sdk_log_check() { | ||
342 | for target in $* | ||
343 | do | ||
344 | lf_path="`dirname ${BB_LOGFILE}`/log.do_$target.${PID}" | ||
345 | |||
346 | echo "log_check: Using $lf_path as logfile" | ||
347 | |||
348 | if [ -e "$lf_path" ]; then | ||
349 | ${IMAGE_PKGTYPE}_log_check $target $lf_path | ||
350 | else | ||
351 | echo "Cannot find logfile [$lf_path]" | ||
352 | fi | ||
353 | echo "Logfile is clean" | ||
354 | done | ||
355 | } | ||
356 | |||
357 | def sdk_command_variables(d): | ||
358 | return ['OPKG_PREPROCESS_COMMANDS','OPKG_POSTPROCESS_COMMANDS','POPULATE_SDK_POST_HOST_COMMAND','POPULATE_SDK_PRE_TARGET_COMMAND','POPULATE_SDK_POST_TARGET_COMMAND','SDK_POSTPROCESS_COMMAND','RPM_PREPROCESS_COMMANDS','RPM_POSTPROCESS_COMMANDS'] | ||
359 | |||
360 | def sdk_variables(d): | ||
361 | variables = ['BUILD_IMAGES_FROM_FEEDS','SDK_OS','SDK_OUTPUT','SDKPATHNATIVE','SDKTARGETSYSROOT','SDK_DIR','SDK_VENDOR','SDKIMAGE_INSTALL_COMPLEMENTARY','SDK_PACKAGE_ARCHS','SDK_OUTPUT', | ||
362 | 'SDKTARGETSYSROOT','MULTILIB_VARIANTS','MULTILIBS','ALL_MULTILIB_PACKAGE_ARCHS','MULTILIB_GLOBAL_VARIANTS','BAD_RECOMMENDATIONS','NO_RECOMMENDATIONS','PACKAGE_ARCHS', | ||
363 | 'PACKAGE_CLASSES','TARGET_VENDOR','TARGET_VENDOR','TARGET_ARCH','TARGET_OS','BBEXTENDVARIANT','FEED_DEPLOYDIR_BASE_URI', 'PACKAGE_EXCLUDE_COMPLEMENTARY', 'IMAGE_INSTALL_DEBUGFS'] | ||
364 | variables.extend(sdk_command_variables(d)) | ||
365 | return " ".join(variables) | ||
366 | |||
367 | do_populate_sdk[vardeps] += "${@sdk_variables(d)}" | ||
368 | |||
369 | python () { | ||
370 | variables = sdk_command_variables(d) | ||
371 | for var in variables: | ||
372 | if d.getVar(var, False): | ||
373 | d.setVarFlag(var, 'func', '1') | ||
374 | } | ||
375 | |||
376 | do_populate_sdk[file-checksums] += "${TOOLCHAIN_SHAR_REL_TMPL}:True \ | ||
377 | ${TOOLCHAIN_SHAR_EXT_TMPL}:True" | ||
378 | |||
379 | do_populate_sdk[dirs] = "${PKGDATA_DIR} ${TOPDIR}" | ||
380 | do_populate_sdk[depends] += "${@' '.join([x + ':do_populate_sysroot' for x in d.getVar('SDK_DEPENDS').split()])} ${@d.getVarFlag('do_rootfs', 'depends', False)}" | ||
381 | do_populate_sdk[rdepends] = "${@' '.join([x + ':do_package_write_${IMAGE_PKGTYPE} ' + x + ':do_packagedata' for x in d.getVar('SDK_RDEPENDS').split()])}" | ||
382 | do_populate_sdk[recrdeptask] += "do_packagedata do_package_write_rpm do_package_write_ipk do_package_write_deb" | ||
383 | do_populate_sdk[file-checksums] += "${POSTINST_INTERCEPT_CHECKSUMS}" | ||
384 | addtask populate_sdk | ||