blob: d03465b6fc94706c742bcda37def266ecd5b57cd [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001inherit meta image-postinst-intercepts
Patrick Williamsc124f4f2015-09-15 14:41:29 -05002
3# Wildcards specifying complementary packages to install for every package that has been explicitly
4# installed into the rootfs
5COMPLEMENTARY_GLOB[dev-pkgs] = '*-dev'
6COMPLEMENTARY_GLOB[staticdev-pkgs] = '*-staticdev'
7COMPLEMENTARY_GLOB[doc-pkgs] = '*-doc'
8COMPLEMENTARY_GLOB[dbg-pkgs] = '*-dbg'
Brad Bishop19323692019-04-05 15:28:33 -04009COMPLEMENTARY_GLOB[src-pkgs] = '*-src'
Patrick Williamsc124f4f2015-09-15 14:41:29 -050010COMPLEMENTARY_GLOB[ptest-pkgs] = '*-ptest'
Brad Bishop00e122a2019-10-05 11:10:57 -040011COMPLEMENTARY_GLOB[bash-completion-pkgs] = '*-bash-completion'
Patrick Williamsc124f4f2015-09-15 14:41:29 -050012
13def complementary_globs(featurevar, d):
14 all_globs = d.getVarFlags('COMPLEMENTARY_GLOB')
15 globs = []
Brad Bishop6e60e8b2018-02-01 10:27:11 -050016 features = set((d.getVar(featurevar) or '').split())
Patrick Williamsc124f4f2015-09-15 14:41:29 -050017 for name, glob in all_globs.items():
18 if name in features:
19 globs.append(glob)
20 return ' '.join(globs)
21
Brad Bishop19323692019-04-05 15:28:33 -040022SDKIMAGE_FEATURES ??= "dev-pkgs dbg-pkgs src-pkgs ${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'doc-pkgs', '', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050023SDKIMAGE_INSTALL_COMPLEMENTARY = '${@complementary_globs("SDKIMAGE_FEATURES", d)}'
24
Brad Bishop316dfdd2018-06-25 12:45:53 -040025PACKAGE_ARCHS_append_task-populate-sdk = " sdk-provides-dummy-target"
26SDK_PACKAGE_ARCHS += "sdk-provides-dummy-${SDKPKGSUFFIX}"
27
Brad Bishop00111322018-04-01 22:23:53 -040028# List of locales to install, or "all" for all of them, or unset for none.
29SDKIMAGE_LINGUAS ?= "all"
30
Patrick Williamsc124f4f2015-09-15 14:41:29 -050031inherit rootfs_${IMAGE_PKGTYPE}
32
33SDK_DIR = "${WORKDIR}/sdk"
34SDK_OUTPUT = "${SDK_DIR}/image"
35SDK_DEPLOY = "${DEPLOY_DIR}/sdk"
36
Patrick Williamsc0f7c042017-02-23 20:41:17 -060037SDKDEPLOYDIR = "${WORKDIR}/${SDKMACHINE}-deploy-${PN}-populate-sdk"
38
Patrick Williamsc124f4f2015-09-15 14:41:29 -050039B_task-populate-sdk = "${SDK_DIR}"
40
41SDKTARGETSYSROOT = "${SDKPATH}/sysroots/${REAL_MULTIMACH_TARGET_SYS}"
42
43TOOLCHAIN_HOST_TASK ?= "nativesdk-packagegroup-sdk-host packagegroup-cross-canadian-${MACHINE}"
44TOOLCHAIN_HOST_TASK_ATTEMPTONLY ?= ""
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080045TOOLCHAIN_TARGET_TASK ?= "${@multilib_pkg_extend(d, 'packagegroup-core-standalone-sdk-target')} target-sdk-provides-dummy"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050046TOOLCHAIN_TARGET_TASK_ATTEMPTONLY ?= ""
47TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-toolchain-${SDK_VERSION}"
48
Brad Bishopc342db32019-05-15 21:57:59 -040049# Default archived SDK's suffix
50SDK_ARCHIVE_TYPE ?= "tar.xz"
51
52# To support different sdk type according to SDK_ARCHIVE_TYPE, now support zip and tar.xz
53python () {
54 if d.getVar('SDK_ARCHIVE_TYPE') == 'zip':
55 d.setVar('SDK_ARCHIVE_DEPENDS', 'zip-native')
56 # SDK_ARCHIVE_CMD used to generate archived sdk ${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} from input dir ${SDK_OUTPUT}/${SDKPATH} to output dir ${SDKDEPLOYDIR}
57 # recommand to cd into input dir first to avoid archive with buildpath
58 d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; zip -r ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} .')
59 else:
60 d.setVar('SDK_ARCHIVE_DEPENDS', 'xz-native')
Brad Bishop15ae2502019-06-18 21:44:24 -040061 d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; tar ${SDKTAROPTS} -cf - . | xz -T 0 -9 > ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE}')
Brad Bishopc342db32019-05-15 21:57:59 -040062}
63
Patrick Williamsc124f4f2015-09-15 14:41:29 -050064SDK_RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}"
Brad Bishopc342db32019-05-15 21:57:59 -040065SDK_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"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080066PATH_prepend = "${STAGING_DIR_HOST}${SDKPATHNATIVE}${bindir}/crossscripts:${@":".join(all_multilib_tune_values(d, 'STAGING_BINDIR_CROSS').split())}:"
Brad Bishopa34c0302019-09-23 22:34:48 -040067SDK_DEPENDS += "nativesdk-glibc-locale"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050068
69# We want the MULTIARCH_TARGET_SYS to point to the TUNE_PKGARCH, not PACKAGE_ARCH as it
70# could be set to the MACHINE_ARCH
71REAL_MULTIMACH_TARGET_SYS = "${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}"
72
73PID = "${@os.getpid()}"
74
75EXCLUDE_FROM_WORLD = "1"
76
77SDK_PACKAGING_FUNC ?= "create_shar"
78SDK_PRE_INSTALL_COMMAND ?= ""
79SDK_POST_INSTALL_COMMAND ?= ""
80SDK_RELOCATE_AFTER_INSTALL ?= "1"
81
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080082SDKEXTPATH ??= "~/${@d.getVar('DISTRO')}_sdk"
83SDK_TITLE ??= "${@d.getVar('DISTRO_NAME') or d.getVar('DISTRO')} SDK"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050084
Patrick Williamsc0f7c042017-02-23 20:41:17 -060085SDK_TARGET_MANIFEST = "${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.target.manifest"
86SDK_HOST_MANIFEST = "${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.host.manifest"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050087SDK_EXT_TARGET_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.target.manifest"
88SDK_EXT_HOST_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.host.manifest"
89
Patrick Williamsc124f4f2015-09-15 14:41:29 -050090python write_target_sdk_manifest () {
91 from oe.sdk import sdk_list_installed_packages
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050092 from oe.utils import format_pkg_list
Brad Bishop6e60e8b2018-02-01 10:27:11 -050093 sdkmanifestdir = os.path.dirname(d.getVar("SDK_TARGET_MANIFEST"))
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050094 pkgs = sdk_list_installed_packages(d, True)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050095 if not os.path.exists(sdkmanifestdir):
96 bb.utils.mkdirhier(sdkmanifestdir)
Brad Bishop6e60e8b2018-02-01 10:27:11 -050097 with open(d.getVar('SDK_TARGET_MANIFEST'), 'w') as output:
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050098 output.write(format_pkg_list(pkgs, 'ver'))
Patrick Williamsc124f4f2015-09-15 14:41:29 -050099}
100
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500101python write_sdk_test_data() {
102 from oe.data import export2json
103 testdata = "%s/%s.testdata.json" % (d.getVar('SDKDEPLOYDIR'), d.getVar('TOOLCHAIN_OUTPUTNAME'))
104 bb.utils.mkdirhier(os.path.dirname(testdata))
105 export2json(d, testdata)
106}
107
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500108python write_host_sdk_manifest () {
109 from oe.sdk import sdk_list_installed_packages
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500110 from oe.utils import format_pkg_list
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500111 sdkmanifestdir = os.path.dirname(d.getVar("SDK_HOST_MANIFEST"))
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500112 pkgs = sdk_list_installed_packages(d, False)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500113 if not os.path.exists(sdkmanifestdir):
114 bb.utils.mkdirhier(sdkmanifestdir)
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500115 with open(d.getVar('SDK_HOST_MANIFEST'), 'w') as output:
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500116 output.write(format_pkg_list(pkgs, 'ver'))
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500117}
118
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500119POPULATE_SDK_POST_TARGET_COMMAND_append = " write_sdk_test_data ; "
120POPULATE_SDK_POST_TARGET_COMMAND_append_task-populate-sdk = " write_target_sdk_manifest ; "
121POPULATE_SDK_POST_HOST_COMMAND_append_task-populate-sdk = " write_host_sdk_manifest; "
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500122SDK_PACKAGING_COMMAND = "${@'${SDK_PACKAGING_FUNC};' if '${SDK_PACKAGING_FUNC}' else ''}"
Brad Bishopc342db32019-05-15 21:57:59 -0400123SDK_POSTPROCESS_COMMAND = " create_sdk_files; check_sdk_sysroots; archive_sdk; ${SDK_PACKAGING_COMMAND} "
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500124
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600125def populate_sdk_common(d):
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500126 from oe.sdk import populate_sdk
127 from oe.manifest import create_manifest, Manifest
128
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500129 # Handle package exclusions
130 excl_pkgs = (d.getVar("PACKAGE_EXCLUDE") or "").split()
131 inst_pkgs = (d.getVar("PACKAGE_INSTALL") or "").split()
132 inst_attempt_pkgs = (d.getVar("PACKAGE_INSTALL_ATTEMPTONLY") or "").split()
133
134 d.setVar('PACKAGE_INSTALL_ORIG', ' '.join(inst_pkgs))
135 d.setVar('PACKAGE_INSTALL_ATTEMPTONLY', ' '.join(inst_attempt_pkgs))
136
137 for pkg in excl_pkgs:
138 if pkg in inst_pkgs:
139 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))
140 inst_pkgs.remove(pkg)
141
142 if pkg in inst_attempt_pkgs:
143 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))
144 inst_attempt_pkgs.remove(pkg)
145
146 d.setVar("PACKAGE_INSTALL", ' '.join(inst_pkgs))
147 d.setVar("PACKAGE_INSTALL_ATTEMPTONLY", ' '.join(inst_attempt_pkgs))
148
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500149 pn = d.getVar('PN')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500150 runtime_mapping_rename("TOOLCHAIN_TARGET_TASK", pn, d)
151 runtime_mapping_rename("TOOLCHAIN_TARGET_TASK_ATTEMPTONLY", pn, d)
152
153 ld = bb.data.createCopy(d)
154 ld.setVar("PKGDATA_DIR", "${STAGING_DIR}/${SDK_ARCH}-${SDKPKGSUFFIX}${SDK_VENDOR}-${SDK_OS}/pkgdata")
155 runtime_mapping_rename("TOOLCHAIN_HOST_TASK", pn, ld)
156 runtime_mapping_rename("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", pn, ld)
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500157 d.setVar("TOOLCHAIN_HOST_TASK", ld.getVar("TOOLCHAIN_HOST_TASK"))
158 d.setVar("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", ld.getVar("TOOLCHAIN_HOST_TASK_ATTEMPTONLY"))
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500159
160 # create target/host SDK manifests
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500161 create_manifest(d, manifest_dir=d.getVar('SDK_DIR'),
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500162 manifest_type=Manifest.MANIFEST_TYPE_SDK_HOST)
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500163 create_manifest(d, manifest_dir=d.getVar('SDK_DIR'),
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500164 manifest_type=Manifest.MANIFEST_TYPE_SDK_TARGET)
165
166 populate_sdk(d)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600167
168fakeroot python do_populate_sdk() {
169 populate_sdk_common(d)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500170}
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600171SSTATETASKS += "do_populate_sdk"
172SSTATE_SKIP_CREATION_task-populate-sdk = '1'
173do_populate_sdk[cleandirs] = "${SDKDEPLOYDIR}"
174do_populate_sdk[sstate-inputdirs] = "${SDKDEPLOYDIR}"
175do_populate_sdk[sstate-outputdirs] = "${SDK_DEPLOY}"
Brad Bishop316dfdd2018-06-25 12:45:53 -0400176do_populate_sdk[stamp-extra-info] = "${MACHINE_ARCH}${SDKMACHINE}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500177
178fakeroot create_sdk_files() {
179 cp ${COREBASE}/scripts/relocate_sdk.py ${SDK_OUTPUT}/${SDKPATH}/
180
181 # Replace the ##DEFAULT_INSTALL_DIR## with the correct pattern.
182 # Escape special characters like '+' and '.' in the SDKPATH
183 escaped_sdkpath=$(echo ${SDKPATH} |sed -e "s:[\+\.]:\\\\\\\\\0:g")
184 sed -i -e "s:##DEFAULT_INSTALL_DIR##:$escaped_sdkpath:" ${SDK_OUTPUT}/${SDKPATH}/relocate_sdk.py
185}
186
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500187python check_sdk_sysroots() {
188 # Fails build if there are broken or dangling symlinks in SDK sysroots
189
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500190 if d.getVar('CHECK_SDK_SYSROOTS') != '1':
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500191 # disabled, bail out
192 return
193
194 def norm_path(path):
195 return os.path.abspath(path)
196
197 # Get scan root
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500198 SCAN_ROOT = norm_path("%s/%s/sysroots/" % (d.getVar('SDK_OUTPUT'),
199 d.getVar('SDKPATH')))
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500200
201 bb.note('Checking SDK sysroots at ' + SCAN_ROOT)
202
203 def check_symlink(linkPath):
204 if not os.path.islink(linkPath):
205 return
206
207 linkDirPath = os.path.dirname(linkPath)
208
209 targetPath = os.readlink(linkPath)
210 if not os.path.isabs(targetPath):
211 targetPath = os.path.join(linkDirPath, targetPath)
212 targetPath = norm_path(targetPath)
213
214 if SCAN_ROOT != os.path.commonprefix( [SCAN_ROOT, targetPath] ):
215 bb.error("Escaping symlink {0!s} --> {1!s}".format(linkPath, targetPath))
216 return
217
218 if not os.path.exists(targetPath):
219 bb.error("Broken symlink {0!s} --> {1!s}".format(linkPath, targetPath))
220 return
221
222 if os.path.isdir(targetPath):
223 dir_walk(targetPath)
224
225 def walk_error_handler(e):
226 bb.error(str(e))
227
228 def dir_walk(rootDir):
229 for dirPath,subDirEntries,fileEntries in os.walk(rootDir, followlinks=False, onerror=walk_error_handler):
230 entries = subDirEntries + fileEntries
231 for e in entries:
232 ePath = os.path.join(dirPath, e)
233 check_symlink(ePath)
234
235 # start
236 dir_walk(SCAN_ROOT)
237}
238
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500239SDKTAROPTS = "--owner=root --group=root"
240
Brad Bishopc342db32019-05-15 21:57:59 -0400241fakeroot archive_sdk() {
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500242 # Package it up
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600243 mkdir -p ${SDKDEPLOYDIR}
Brad Bishopc342db32019-05-15 21:57:59 -0400244 ${SDK_ARCHIVE_CMD}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500245}
246
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800247TOOLCHAIN_SHAR_EXT_TMPL ?= "${COREBASE}/meta/files/toolchain-shar-extract.sh"
248TOOLCHAIN_SHAR_REL_TMPL ?= "${COREBASE}/meta/files/toolchain-shar-relocate.sh"
249
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500250fakeroot create_shar() {
251 # copy in the template shar extractor script
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800252 cp ${TOOLCHAIN_SHAR_EXT_TMPL} ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500253
254 rm -f ${T}/pre_install_command ${T}/post_install_command
255
256 if [ ${SDK_RELOCATE_AFTER_INSTALL} -eq 1 ] ; then
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800257 cp ${TOOLCHAIN_SHAR_REL_TMPL} ${T}/post_install_command
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500258 fi
259 cat << "EOF" >> ${T}/pre_install_command
260${SDK_PRE_INSTALL_COMMAND}
261EOF
262
263 cat << "EOF" >> ${T}/post_install_command
264${SDK_POST_INSTALL_COMMAND}
265EOF
266 sed -i -e '/@SDK_PRE_INSTALL_COMMAND@/r ${T}/pre_install_command' \
267 -e '/@SDK_POST_INSTALL_COMMAND@/r ${T}/post_install_command' \
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600268 ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500269
270 # substitute variables
271 sed -i -e 's#@SDK_ARCH@#${SDK_ARCH}#g' \
272 -e 's#@SDKPATH@#${SDKPATH}#g' \
273 -e 's#@SDKEXTPATH@#${SDKEXTPATH}#g' \
274 -e 's#@OLDEST_KERNEL@#${SDK_OLDEST_KERNEL}#g' \
275 -e 's#@REAL_MULTIMACH_TARGET_SYS@#${REAL_MULTIMACH_TARGET_SYS}#g' \
Brad Bishop19323692019-04-05 15:28:33 -0400276 -e 's#@SDK_TITLE@#${@d.getVar("SDK_TITLE").replace('&', '\\&')}#g' \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500277 -e 's#@SDK_VERSION@#${SDK_VERSION}#g' \
278 -e '/@SDK_PRE_INSTALL_COMMAND@/d' \
279 -e '/@SDK_POST_INSTALL_COMMAND@/d' \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800280 -e 's#@SDK_GCC_VER@#${@oe.utils.host_gcc_version(d, taskcontextonly=True)}#g' \
Brad Bishopc342db32019-05-15 21:57:59 -0400281 -e 's#@SDK_ARCHIVE_TYPE@#${SDK_ARCHIVE_TYPE}#g' \
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600282 ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500283
284 # add execution permission
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600285 chmod +x ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500286
287 # append the SDK tarball
Brad Bishopc342db32019-05-15 21:57:59 -0400288 cat ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} >> ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500289
290 # delete the old tarball, we don't need it anymore
Brad Bishopc342db32019-05-15 21:57:59 -0400291 rm ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500292}
293
294populate_sdk_log_check() {
295 for target in $*
296 do
297 lf_path="`dirname ${BB_LOGFILE}`/log.do_$target.${PID}"
298
299 echo "log_check: Using $lf_path as logfile"
300
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500301 if [ -e "$lf_path" ]; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500302 ${IMAGE_PKGTYPE}_log_check $target $lf_path
303 else
304 echo "Cannot find logfile [$lf_path]"
305 fi
306 echo "Logfile is clean"
307 done
308}
309
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500310def sdk_command_variables(d):
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500311 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']
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500312
313def sdk_variables(d):
314 variables = ['BUILD_IMAGES_FROM_FEEDS','SDK_OS','SDK_OUTPUT','SDKPATHNATIVE','SDKTARGETSYSROOT','SDK_DIR','SDK_VENDOR','SDKIMAGE_INSTALL_COMPLEMENTARY','SDK_PACKAGE_ARCHS','SDK_OUTPUT',
315 'SDKTARGETSYSROOT','MULTILIB_VARIANTS','MULTILIBS','ALL_MULTILIB_PACKAGE_ARCHS','MULTILIB_GLOBAL_VARIANTS','BAD_RECOMMENDATIONS','NO_RECOMMENDATIONS','PACKAGE_ARCHS',
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800316 'PACKAGE_CLASSES','TARGET_VENDOR','TARGET_VENDOR','TARGET_ARCH','TARGET_OS','BBEXTENDVARIANT','FEED_DEPLOYDIR_BASE_URI', 'PACKAGE_EXCLUDE_COMPLEMENTARY', 'IMAGE_INSTALL_DEBUGFS']
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500317 variables.extend(sdk_command_variables(d))
318 return " ".join(variables)
319
320do_populate_sdk[vardeps] += "${@sdk_variables(d)}"
321
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800322do_populate_sdk[file-checksums] += "${TOOLCHAIN_SHAR_REL_TMPL}:True \
323 ${TOOLCHAIN_SHAR_EXT_TMPL}:True"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500324
Patrick Williamsf1e5d692016-03-30 15:21:19 -0500325do_populate_sdk[dirs] = "${PKGDATA_DIR} ${TOPDIR}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500326do_populate_sdk[depends] += "${@' '.join([x + ':do_populate_sysroot' for x in d.getVar('SDK_DEPENDS').split()])} ${@d.getVarFlag('do_rootfs', 'depends', False)}"
327do_populate_sdk[rdepends] = "${@' '.join([x + ':do_package_write_${IMAGE_PKGTYPE} ' + x + ':do_packagedata' for x in d.getVar('SDK_RDEPENDS').split()])}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500328do_populate_sdk[recrdeptask] += "do_packagedata do_package_write_rpm do_package_write_ipk do_package_write_deb"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800329do_populate_sdk[file-checksums] += "${POSTINST_INTERCEPT_CHECKSUMS}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500330addtask populate_sdk