blob: d287065e08b3d4b620e76ecf587de1e3a78d6f83 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001BB_DEFAULT_TASK ?= "build"
2CLASSOVERRIDE ?= "class-target"
3
4inherit patch
5inherit staging
6
7inherit mirrors
8inherit utils
9inherit utility-tasks
10inherit metadata_scm
11inherit logging
12
Brad Bishop15ae2502019-06-18 21:44:24 -040013OE_EXTRA_IMPORTS ?= ""
14
15OE_IMPORTS += "os sys time oe.path oe.utils oe.types oe.package oe.packagegroup oe.sstatesig oe.lsb oe.cachedpath oe.license ${OE_EXTRA_IMPORTS}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050016OE_IMPORTS[type] = "list"
17
Brad Bishopf3fd2882019-06-21 08:06:37 -040018PACKAGECONFIG_CONFARGS ??= ""
19
Patrick Williamsc124f4f2015-09-15 14:41:29 -050020def oe_import(d):
21 import sys
22
Brad Bishop6e60e8b2018-02-01 10:27:11 -050023 bbpath = d.getVar("BBPATH").split(":")
Patrick Williamsc124f4f2015-09-15 14:41:29 -050024 sys.path[0:0] = [os.path.join(dir, "lib") for dir in bbpath]
25
26 def inject(name, value):
27 """Make a python object accessible from the metadata"""
28 if hasattr(bb.utils, "_context"):
29 bb.utils._context[name] = value
30 else:
31 __builtins__[name] = value
32
33 import oe.data
34 for toimport in oe.data.typed_value("OE_IMPORTS", d):
Brad Bishop00e122a2019-10-05 11:10:57 -040035 try:
36 imported = __import__(toimport)
37 inject(toimport.split(".", 1)[0], imported)
38 except AttributeError as e:
39 bb.error("Error importing OE modules: %s" % str(e))
Patrick Williamsc124f4f2015-09-15 14:41:29 -050040 return ""
41
42# We need the oe module name space early (before INHERITs get added)
43OE_IMPORTED := "${@oe_import(d)}"
44
45def lsb_distro_identifier(d):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050046 adjust = d.getVar('LSB_DISTRO_ADJUST')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050047 adjust_func = None
48 if adjust:
49 try:
50 adjust_func = globals()[adjust]
51 except KeyError:
52 pass
53 return oe.lsb.distro_identifier(adjust_func)
54
55die() {
56 bbfatal_log "$*"
57}
58
59oe_runmake_call() {
60 bbnote ${MAKE} ${EXTRA_OEMAKE} "$@"
61 ${MAKE} ${EXTRA_OEMAKE} "$@"
62}
63
64oe_runmake() {
65 oe_runmake_call "$@" || die "oe_runmake failed"
66}
67
68
69def base_dep_prepend(d):
Brad Bishopd7bf8c12018-02-25 22:55:05 -050070 if d.getVar('INHIBIT_DEFAULT_DEPS', False):
71 return ""
72 return "${BASE_DEFAULT_DEPS}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050073
Brad Bishopd7bf8c12018-02-25 22:55:05 -050074BASE_DEFAULT_DEPS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}compilerlibs virtual/libc"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050075
Brad Bishopd7bf8c12018-02-25 22:55:05 -050076BASEDEPENDS = ""
77BASEDEPENDS_class-target = "${@base_dep_prepend(d)}"
78BASEDEPENDS_class-nativesdk = "${@base_dep_prepend(d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050079
80DEPENDS_prepend="${BASEDEPENDS} "
81
82FILESPATH = "${@base_set_filespath(["${FILE_DIRNAME}/${BP}", "${FILE_DIRNAME}/${BPN}", "${FILE_DIRNAME}/files"], d)}"
83# THISDIR only works properly with imediate expansion as it has to run
84# in the context of the location its used (:=)
Brad Bishop6e60e8b2018-02-01 10:27:11 -050085THISDIR = "${@os.path.dirname(d.getVar('FILE'))}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050086
87def extra_path_elements(d):
88 path = ""
Brad Bishop6e60e8b2018-02-01 10:27:11 -050089 elements = (d.getVar('EXTRANATIVEPATH') or "").split()
Patrick Williamsc124f4f2015-09-15 14:41:29 -050090 for e in elements:
91 path = path + "${STAGING_BINDIR_NATIVE}/" + e + ":"
92 return path
93
94PATH_prepend = "${@extra_path_elements(d)}"
95
96def get_lic_checksum_file_list(d):
97 filelist = []
Brad Bishop6e60e8b2018-02-01 10:27:11 -050098 lic_files = d.getVar("LIC_FILES_CHKSUM") or ''
99 tmpdir = d.getVar("TMPDIR")
100 s = d.getVar("S")
101 b = d.getVar("B")
102 workdir = d.getVar("WORKDIR")
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500103
104 urls = lic_files.split()
105 for url in urls:
106 # We only care about items that are absolute paths since
107 # any others should be covered by SRC_URI.
108 try:
Brad Bishop220d5532018-08-14 00:59:39 +0100109 (method, host, path, user, pswd, parm) = bb.fetch.decodeurl(url)
110 if method != "file" or not path:
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600111 raise bb.fetch.MalformedUrl(url)
112
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500113 if path[0] == '/':
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500114 if path.startswith((tmpdir, s, b, workdir)):
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500115 continue
116 filelist.append(path + ":" + str(os.path.exists(path)))
117 except bb.fetch.MalformedUrl:
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500118 bb.fatal(d.getVar('PN') + ": LIC_FILES_CHKSUM contains an invalid URL: " + url)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500119 return " ".join(filelist)
120
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500121def setup_hosttools_dir(dest, toolsvar, d, fatal=True):
122 tools = d.getVar(toolsvar).split()
123 origbbenv = d.getVar("BB_ORIGENV", False)
124 path = origbbenv.getVar("PATH")
125 bb.utils.mkdirhier(dest)
126 notfound = []
127 for tool in tools:
128 desttool = os.path.join(dest, tool)
129 if not os.path.exists(desttool):
Andrew Geissler82c905d2020-04-13 13:39:40 -0500130 # clean up dead symlink
131 if os.path.islink(desttool):
132 os.unlink(desttool)
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500133 srctool = bb.utils.which(path, tool, executable=True)
Brad Bishop19323692019-04-05 15:28:33 -0400134 # gcc/g++ may link to ccache on some hosts, e.g.,
135 # /usr/local/bin/ccache/gcc -> /usr/bin/ccache, then which(gcc)
136 # would return /usr/local/bin/ccache/gcc, but what we need is
137 # /usr/bin/gcc, this code can check and fix that.
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500138 if "ccache" in srctool:
139 srctool = bb.utils.which(path, tool, executable=True, direction=1)
140 if srctool:
141 os.symlink(srctool, desttool)
142 else:
143 notfound.append(tool)
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800144
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500145 if notfound and fatal:
146 bb.fatal("The following required tools (as specified by HOSTTOOLS) appear to be unavailable in PATH, please install them in order to proceed:\n %s" % " ".join(notfound))
147
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500148addtask fetch
149do_fetch[dirs] = "${DL_DIR}"
150do_fetch[file-checksums] = "${@bb.fetch.get_checksum_file_list(d)}"
151do_fetch[file-checksums] += " ${@get_lic_checksum_file_list(d)}"
152do_fetch[vardeps] += "SRCREV"
153python base_do_fetch() {
154
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500155 src_uri = (d.getVar('SRC_URI') or "").split()
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500156 if len(src_uri) == 0:
157 return
158
159 try:
160 fetcher = bb.fetch2.Fetch(src_uri, d)
161 fetcher.download()
162 except bb.fetch2.BBFetchException as e:
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600163 bb.fatal(str(e))
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500164}
165
166addtask unpack after do_fetch
167do_unpack[dirs] = "${WORKDIR}"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600168
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800169do_unpack[cleandirs] = "${@d.getVar('S') if os.path.normpath(d.getVar('S')) != os.path.normpath(d.getVar('WORKDIR')) else os.path.join('${S}', 'patches')}"
Brad Bishop316dfdd2018-06-25 12:45:53 -0400170
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500171python base_do_unpack() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500172 src_uri = (d.getVar('SRC_URI') or "").split()
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500173 if len(src_uri) == 0:
174 return
175
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500176 try:
177 fetcher = bb.fetch2.Fetch(src_uri, d)
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500178 fetcher.unpack(d.getVar('WORKDIR'))
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500179 except bb.fetch2.BBFetchException as e:
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600180 bb.fatal(str(e))
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500181}
182
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500183def get_layers_branch_rev(d):
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500184 layers = (d.getVar("BBLAYERS") or "").split()
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500185 layers_branch_rev = ["%-20s = \"%s:%s\"" % (os.path.basename(i), \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500186 base_get_metadata_git_branch(i, None).strip(), \
187 base_get_metadata_git_revision(i, None)) \
188 for i in layers]
189 i = len(layers_branch_rev)-1
190 p1 = layers_branch_rev[i].find("=")
191 s1 = layers_branch_rev[i][p1:]
192 while i > 0:
193 p2 = layers_branch_rev[i-1].find("=")
194 s2= layers_branch_rev[i-1][p2:]
195 if s1 == s2:
196 layers_branch_rev[i-1] = layers_branch_rev[i-1][0:p2]
197 i -= 1
198 else:
199 i -= 1
200 p1 = layers_branch_rev[i].find("=")
201 s1= layers_branch_rev[i][p1:]
202 return layers_branch_rev
203
204
205BUILDCFG_FUNCS ??= "buildcfg_vars get_layers_branch_rev buildcfg_neededvars"
206BUILDCFG_FUNCS[type] = "list"
207
208def buildcfg_vars(d):
209 statusvars = oe.data.typed_value('BUILDCFG_VARS', d)
210 for var in statusvars:
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500211 value = d.getVar(var)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500212 if value is not None:
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500213 yield '%-20s = "%s"' % (var, value)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500214
215def buildcfg_neededvars(d):
216 needed_vars = oe.data.typed_value("BUILDCFG_NEEDEDVARS", d)
217 pesteruser = []
218 for v in needed_vars:
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500219 val = d.getVar(v)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500220 if not val or val == 'INVALID':
221 pesteruser.append(v)
222
223 if pesteruser:
224 bb.fatal('The following variable(s) were not set: %s\nPlease set them directly, or choose a MACHINE or DISTRO that sets them.' % ', '.join(pesteruser))
225
226addhandler base_eventhandler
Brad Bishop19323692019-04-05 15:28:33 -0400227base_eventhandler[eventmask] = "bb.event.ConfigParsed bb.event.MultiConfigParsed bb.event.BuildStarted bb.event.RecipePreFinalise bb.event.RecipeParsed"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500228python base_eventhandler() {
229 import bb.runqueue
230
231 if isinstance(e, bb.event.ConfigParsed):
Brad Bishop316dfdd2018-06-25 12:45:53 -0400232 if not d.getVar("NATIVELSBSTRING", False):
233 d.setVar("NATIVELSBSTRING", lsb_distro_identifier(d))
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600234 d.setVar("ORIGNATIVELSBSTRING", d.getVar("NATIVELSBSTRING", False))
Brad Bishop316dfdd2018-06-25 12:45:53 -0400235 d.setVar('BB_VERSION', bb.__version__)
Brad Bishop19323692019-04-05 15:28:33 -0400236
237 # There might be no bb.event.ConfigParsed event if bitbake server is
238 # running, so check bb.event.BuildStarted too to make sure ${HOSTTOOLS_DIR}
239 # exists.
240 if isinstance(e, bb.event.ConfigParsed) or \
241 (isinstance(e, bb.event.BuildStarted) and not os.path.exists(d.getVar('HOSTTOOLS_DIR'))):
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500242 # Works with the line in layer.conf which changes PATH to point here
243 setup_hosttools_dir(d.getVar('HOSTTOOLS_DIR'), 'HOSTTOOLS', d)
244 setup_hosttools_dir(d.getVar('HOSTTOOLS_DIR'), 'HOSTTOOLS_NONFATAL', d, fatal=False)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500245
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500246 if isinstance(e, bb.event.MultiConfigParsed):
247 # We need to expand SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS in each of the multiconfig data stores
248 # own contexts so the variables get expanded correctly for that arch, then inject back into
249 # the main data store.
250 deps = []
251 for config in e.mcdata:
252 deps.append(e.mcdata[config].getVar("SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS"))
253 deps = " ".join(deps)
254 e.mcdata[''].setVar("SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS", deps)
255
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500256 if isinstance(e, bb.event.BuildStarted):
Brad Bishop316dfdd2018-06-25 12:45:53 -0400257 localdata = bb.data.createCopy(d)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500258 statuslines = []
259 for func in oe.data.typed_value('BUILDCFG_FUNCS', localdata):
260 g = globals()
261 if func not in g:
262 bb.warn("Build configuration function '%s' does not exist" % func)
263 else:
264 flines = g[func](localdata)
265 if flines:
266 statuslines.extend(flines)
267
Brad Bishop316dfdd2018-06-25 12:45:53 -0400268 statusheader = d.getVar('BUILDCFG_HEADER')
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500269 if statusheader:
270 bb.plain('\n%s\n%s\n' % (statusheader, '\n'.join(statuslines)))
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500271
272 # This code is to silence warnings where the SDK variables overwrite the
273 # target ones and we'd see dulpicate key names overwriting each other
274 # for various PREFERRED_PROVIDERS
275 if isinstance(e, bb.event.RecipePreFinalise):
Brad Bishop316dfdd2018-06-25 12:45:53 -0400276 if d.getVar("TARGET_PREFIX") == d.getVar("SDK_PREFIX"):
277 d.delVar("PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}binutils")
Brad Bishop316dfdd2018-06-25 12:45:53 -0400278 d.delVar("PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc")
279 d.delVar("PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}g++")
280 d.delVar("PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}compilerlibs")
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500281
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500282 if isinstance(e, bb.event.RecipeParsed):
283 #
284 # If we have multiple providers of virtual/X and a PREFERRED_PROVIDER_virtual/X is set
285 # skip parsing for all the other providers which will mean they get uninstalled from the
286 # sysroot since they're now "unreachable". This makes switching virtual/kernel work in
287 # particular.
288 #
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500289 pn = d.getVar('PN')
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500290 source_mirror_fetch = d.getVar('SOURCE_MIRROR_FETCH', False)
291 if not source_mirror_fetch:
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500292 provs = (d.getVar("PROVIDES") or "").split()
293 multiwhitelist = (d.getVar("MULTI_PROVIDER_WHITELIST") or "").split()
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500294 for p in provs:
295 if p.startswith("virtual/") and p not in multiwhitelist:
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500296 profprov = d.getVar("PREFERRED_PROVIDER_" + p)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500297 if profprov and pn != profprov:
Brad Bishop316dfdd2018-06-25 12:45:53 -0400298 raise bb.parse.SkipRecipe("PREFERRED_PROVIDER_%s set to %s, not %s" % (p, profprov, pn))
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500299}
300
301CONFIGURESTAMPFILE = "${WORKDIR}/configure.sstate"
302CLEANBROKEN = "0"
303
304addtask configure after do_patch
305do_configure[dirs] = "${B}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500306base_do_configure() {
307 if [ -n "${CONFIGURESTAMPFILE}" -a -e "${CONFIGURESTAMPFILE}" ]; then
308 if [ "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" ]; then
309 cd ${B}
310 if [ "${CLEANBROKEN}" != "1" -a \( -e Makefile -o -e makefile -o -e GNUmakefile \) ]; then
311 oe_runmake clean
312 fi
Brad Bishopc4ea0752018-11-15 14:30:15 -0800313 # -ignore_readdir_race does not work correctly with -delete;
314 # use xargs to avoid spurious build failures
315 find ${B} -ignore_readdir_race -name \*.la -type f -print0 | xargs -0 rm -f
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500316 fi
317 fi
318 if [ -n "${CONFIGURESTAMPFILE}" ]; then
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500319 mkdir -p `dirname ${CONFIGURESTAMPFILE}`
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500320 echo ${BB_TASKHASH} > ${CONFIGURESTAMPFILE}
321 fi
322}
323
324addtask compile after do_configure
325do_compile[dirs] = "${B}"
326base_do_compile() {
327 if [ -e Makefile -o -e makefile -o -e GNUmakefile ]; then
328 oe_runmake || die "make failed"
329 else
330 bbnote "nothing to compile"
331 fi
332}
333
334addtask install after do_compile
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600335do_install[dirs] = "${B}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500336# Remove and re-create ${D} so that is it guaranteed to be empty
337do_install[cleandirs] = "${D}"
338
339base_do_install() {
340 :
341}
342
343base_do_package() {
344 :
345}
346
347addtask build after do_populate_sysroot
348do_build[noexec] = "1"
349do_build[recrdeptask] += "do_deploy"
350do_build () {
351 :
352}
353
354def set_packagetriplet(d):
355 archs = []
356 tos = []
357 tvs = []
358
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500359 archs.append(d.getVar("PACKAGE_ARCHS").split())
360 tos.append(d.getVar("TARGET_OS"))
361 tvs.append(d.getVar("TARGET_VENDOR"))
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500362
363 def settriplet(d, varname, archs, tos, tvs):
364 triplets = []
365 for i in range(len(archs)):
366 for arch in archs[i]:
367 triplets.append(arch + tvs[i] + "-" + tos[i])
368 triplets.reverse()
369 d.setVar(varname, " ".join(triplets))
370
371 settriplet(d, "PKGTRIPLETS", archs, tos, tvs)
372
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500373 variants = d.getVar("MULTILIB_VARIANTS") or ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500374 for item in variants.split():
375 localdata = bb.data.createCopy(d)
376 overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + item
377 localdata.setVar("OVERRIDES", overrides)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500378
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500379 archs.append(localdata.getVar("PACKAGE_ARCHS").split())
380 tos.append(localdata.getVar("TARGET_OS"))
381 tvs.append(localdata.getVar("TARGET_VENDOR"))
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500382
383 settriplet(d, "PKGMLTRIPLETS", archs, tos, tvs)
384
385python () {
386 import string, re
387
Brad Bishop316dfdd2018-06-25 12:45:53 -0400388 # Handle backfilling
389 oe.utils.features_backfill("DISTRO_FEATURES", d)
390 oe.utils.features_backfill("MACHINE_FEATURES", d)
391
Andrew Geisslerf0343792020-11-18 10:42:21 -0600392 if d.getVar("S")[-1] == '/':
393 bb.warn("Recipe %s sets S variable with trailing slash '%s', remove it" % (d.getVar("PN"), d.getVar("S")))
394 if d.getVar("B")[-1] == '/':
395 bb.warn("Recipe %s sets B variable with trailing slash '%s', remove it" % (d.getVar("PN"), d.getVar("B")))
396
397 if os.path.normpath(d.getVar("WORKDIR")) != os.path.normpath(d.getVar("S")):
398 d.appendVar("PSEUDO_IGNORE_PATHS", ",${S}")
399 if os.path.normpath(d.getVar("WORKDIR")) != os.path.normpath(d.getVar("B")):
400 d.appendVar("PSEUDO_IGNORE_PATHS", ",${B}")
401
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500402 # Handle PACKAGECONFIG
403 #
404 # These take the form:
405 #
406 # PACKAGECONFIG ??= "<default options>"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500407 # PACKAGECONFIG[foo] = "--enable-foo,--disable-foo,foo_depends,foo_runtime_depends,foo_runtime_recommends,foo_conflict_packageconfig"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500408 pkgconfigflags = d.getVarFlags("PACKAGECONFIG") or {}
409 if pkgconfigflags:
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500410 pkgconfig = (d.getVar('PACKAGECONFIG') or "").split()
411 pn = d.getVar("PN")
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500412
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500413 mlprefix = d.getVar("MLPREFIX")
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500414
415 def expandFilter(appends, extension, prefix):
416 appends = bb.utils.explode_deps(d.expand(" ".join(appends)))
417 newappends = []
418 for a in appends:
419 if a.endswith("-native") or ("-cross-" in a):
420 newappends.append(a)
421 elif a.startswith("virtual/"):
422 subs = a.split("/", 1)[1]
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500423 if subs.startswith(prefix):
424 newappends.append(a + extension)
425 else:
426 newappends.append("virtual/" + prefix + subs + extension)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500427 else:
428 if a.startswith(prefix):
429 newappends.append(a + extension)
430 else:
431 newappends.append(prefix + a + extension)
432 return newappends
433
434 def appendVar(varname, appends):
435 if not appends:
436 return
437 if varname.find("DEPENDS") != -1:
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500438 if bb.data.inherits_class('nativesdk', d) or bb.data.inherits_class('cross-canadian', d) :
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500439 appends = expandFilter(appends, "", "nativesdk-")
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500440 elif bb.data.inherits_class('native', d):
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500441 appends = expandFilter(appends, "-native", "")
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500442 elif mlprefix:
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500443 appends = expandFilter(appends, "", mlprefix)
444 varname = d.expand(varname)
445 d.appendVar(varname, " " + " ".join(appends))
446
447 extradeps = []
448 extrardeps = []
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500449 extrarrecs = []
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500450 extraconf = []
451 for flag, flagval in sorted(pkgconfigflags.items()):
452 items = flagval.split(",")
453 num = len(items)
Andrew Geissler82c905d2020-04-13 13:39:40 -0500454 if num > 6:
455 bb.error("%s: PACKAGECONFIG[%s] Only enable,disable,depend,rdepend,rrecommend,conflict_packageconfig can be specified!"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500456 % (d.getVar('PN'), flag))
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500457
458 if flag in pkgconfig:
459 if num >= 3 and items[2]:
460 extradeps.append(items[2])
461 if num >= 4 and items[3]:
462 extrardeps.append(items[3])
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500463 if num >= 5 and items[4]:
464 extrarrecs.append(items[4])
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500465 if num >= 1 and items[0]:
466 extraconf.append(items[0])
467 elif num >= 2 and items[1]:
468 extraconf.append(items[1])
Andrew Geissler82c905d2020-04-13 13:39:40 -0500469
470 if num >= 6 and items[5]:
471 conflicts = set(items[5].split())
472 invalid = conflicts.difference(set(pkgconfigflags.keys()))
473 if invalid:
474 bb.error("%s: PACKAGECONFIG[%s] Invalid conflict package config%s '%s' specified."
475 % (d.getVar('PN'), flag, 's' if len(invalid) > 1 else '', ' '.join(invalid)))
476
477 if flag in pkgconfig:
478 intersec = conflicts.intersection(set(pkgconfig))
479 if intersec:
480 bb.fatal("%s: PACKAGECONFIG[%s] Conflict package config%s '%s' set in PACKAGECONFIG."
481 % (d.getVar('PN'), flag, 's' if len(intersec) > 1 else '', ' '.join(intersec)))
482
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500483 appendVar('DEPENDS', extradeps)
484 appendVar('RDEPENDS_${PN}', extrardeps)
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500485 appendVar('RRECOMMENDS_${PN}', extrarrecs)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500486 appendVar('PACKAGECONFIG_CONFARGS', extraconf)
487
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500488 pn = d.getVar('PN')
489 license = d.getVar('LICENSE')
Brad Bishop316dfdd2018-06-25 12:45:53 -0400490 if license == "INVALID" and pn != "defaultpkgname":
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500491 bb.fatal('This recipe does not have the LICENSE field set (%s)' % pn)
492
493 if bb.data.inherits_class('license', d):
494 check_license_format(d)
Brad Bishop19323692019-04-05 15:28:33 -0400495 unmatched_license_flags = check_license_flags(d)
496 if unmatched_license_flags:
497 if len(unmatched_license_flags) == 1:
498 message = "because it has a restricted license '{0}'. Which is not whitelisted in LICENSE_FLAGS_WHITELIST".format(unmatched_license_flags[0])
499 else:
500 message = "because it has restricted licenses {0}. Which are not whitelisted in LICENSE_FLAGS_WHITELIST".format(
501 ", ".join("'{0}'".format(f) for f in unmatched_license_flags))
502 bb.debug(1, "Skipping %s %s" % (pn, message))
503 raise bb.parse.SkipRecipe(message)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500504
505 # If we're building a target package we need to use fakeroot (pseudo)
506 # in order to capture permissions, owners, groups and special files
507 if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d):
Brad Bishop64c979e2019-11-04 13:55:29 -0500508 d.appendVarFlag('do_prepare_recipe_sysroot', 'depends', ' virtual/fakeroot-native:do_populate_sysroot')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500509 d.setVarFlag('do_unpack', 'umask', '022')
510 d.setVarFlag('do_configure', 'umask', '022')
511 d.setVarFlag('do_compile', 'umask', '022')
512 d.appendVarFlag('do_install', 'depends', ' virtual/fakeroot-native:do_populate_sysroot')
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500513 d.setVarFlag('do_install', 'fakeroot', '1')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500514 d.setVarFlag('do_install', 'umask', '022')
515 d.appendVarFlag('do_package', 'depends', ' virtual/fakeroot-native:do_populate_sysroot')
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500516 d.setVarFlag('do_package', 'fakeroot', '1')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500517 d.setVarFlag('do_package', 'umask', '022')
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500518 d.setVarFlag('do_package_setscene', 'fakeroot', '1')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500519 d.appendVarFlag('do_package_setscene', 'depends', ' virtual/fakeroot-native:do_populate_sysroot')
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500520 d.setVarFlag('do_devshell', 'fakeroot', '1')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500521 d.appendVarFlag('do_devshell', 'depends', ' virtual/fakeroot-native:do_populate_sysroot')
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500522
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500523 need_machine = d.getVar('COMPATIBLE_MACHINE')
Andrew Geissler82c905d2020-04-13 13:39:40 -0500524 if need_machine and not d.getVar('PARSE_ALL_RECIPES', False):
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500525 import re
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500526 compat_machines = (d.getVar('MACHINEOVERRIDES') or "").split(":")
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500527 for m in compat_machines:
528 if re.match(need_machine, m):
529 break
530 else:
Brad Bishop316dfdd2018-06-25 12:45:53 -0400531 raise bb.parse.SkipRecipe("incompatible with machine %s (not in COMPATIBLE_MACHINE)" % d.getVar('MACHINE'))
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500532
Andrew Geissler82c905d2020-04-13 13:39:40 -0500533 source_mirror_fetch = d.getVar('SOURCE_MIRROR_FETCH', False) or d.getVar('PARSE_ALL_RECIPES', False)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500534 if not source_mirror_fetch:
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500535 need_host = d.getVar('COMPATIBLE_HOST')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500536 if need_host:
537 import re
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500538 this_host = d.getVar('HOST_SYS')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500539 if not re.match(need_host, this_host):
Brad Bishop316dfdd2018-06-25 12:45:53 -0400540 raise bb.parse.SkipRecipe("incompatible with host %s (not in COMPATIBLE_HOST)" % this_host)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500541
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500542 bad_licenses = (d.getVar('INCOMPATIBLE_LICENSE') or "").split()
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500543
544 check_license = False if pn.startswith("nativesdk-") else True
545 for t in ["-native", "-cross-${TARGET_ARCH}", "-cross-initial-${TARGET_ARCH}",
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600546 "-crosssdk-${SDK_SYS}", "-crosssdk-initial-${SDK_SYS}",
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500547 "-cross-canadian-${TRANSLATED_TARGET_ARCH}"]:
548 if pn.endswith(d.expand(t)):
549 check_license = False
550 if pn.startswith("gcc-source-"):
551 check_license = False
552
553 if check_license and bad_licenses:
554 bad_licenses = expand_wildcard_licenses(d, bad_licenses)
555
556 whitelist = []
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500557 for lic in bad_licenses:
558 spdx_license = return_spdx(d, lic)
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800559 whitelist.extend((d.getVar("WHITELIST_" + lic) or "").split())
560 if spdx_license:
561 whitelist.extend((d.getVar("WHITELIST_" + spdx_license) or "").split())
Andrew Geissler82c905d2020-04-13 13:39:40 -0500562
563 if pn in whitelist:
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800564 '''
565 We need to track what we are whitelisting and why. If pn is
566 incompatible we need to be able to note that the image that
567 is created may infact contain incompatible licenses despite
568 INCOMPATIBLE_LICENSE being set.
569 '''
Andrew Geissler82c905d2020-04-13 13:39:40 -0500570 bb.note("Including %s as buildable despite it having an incompatible license because it has been whitelisted" % pn)
571 else:
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500572 pkgs = d.getVar('PACKAGES').split()
Andrew Geissler82c905d2020-04-13 13:39:40 -0500573 skipped_pkgs = {}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500574 unskipped_pkgs = []
575 for pkg in pkgs:
Andrew Geissler82c905d2020-04-13 13:39:40 -0500576 incompatible_lic = incompatible_license(d, bad_licenses, pkg)
577 if incompatible_lic:
578 skipped_pkgs[pkg] = incompatible_lic
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500579 else:
580 unskipped_pkgs.append(pkg)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500581 if unskipped_pkgs:
582 for pkg in skipped_pkgs:
Andrew Geissler82c905d2020-04-13 13:39:40 -0500583 bb.debug(1, "Skipping the package %s at do_rootfs because of incompatible license(s): %s" % (pkg, ' '.join(skipped_pkgs[pkg])))
Andrew Geissler1e34c2d2020-05-29 16:02:59 -0500584 d.setVar('LICENSE_EXCLUSION-' + pkg, ' '.join(skipped_pkgs[pkg]))
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500585 for pkg in unskipped_pkgs:
Andrew Geissler82c905d2020-04-13 13:39:40 -0500586 bb.debug(1, "Including the package %s" % pkg)
587 else:
588 incompatible_lic = incompatible_license(d, bad_licenses)
589 for pkg in skipped_pkgs:
590 incompatible_lic += skipped_pkgs[pkg]
591 incompatible_lic = sorted(list(set(incompatible_lic)))
592
593 if incompatible_lic:
594 bb.debug(1, "Skipping recipe %s because of incompatible license(s): %s" % (pn, ' '.join(incompatible_lic)))
595 raise bb.parse.SkipRecipe("it has incompatible license(s): %s" % ' '.join(incompatible_lic))
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500596
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500597 needsrcrev = False
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500598 srcuri = d.getVar('SRC_URI')
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600599 for uri_string in srcuri.split():
600 uri = bb.fetch.URI(uri_string)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500601
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500602 # HTTP/FTP use the wget fetcher
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600603 if uri.scheme in ("http", "https", "ftp"):
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500604 d.appendVarFlag('do_fetch', 'depends', ' wget-native:do_populate_sysroot')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500605
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500606 # Svn packages should DEPEND on subversion-native
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600607 if uri.scheme == "svn":
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500608 needsrcrev = True
609 d.appendVarFlag('do_fetch', 'depends', ' subversion-native:do_populate_sysroot')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500610
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500611 # Git packages should DEPEND on git-native
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600612 elif uri.scheme in ("git", "gitsm"):
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500613 needsrcrev = True
614 d.appendVarFlag('do_fetch', 'depends', ' git-native:do_populate_sysroot')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500615
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500616 # Mercurial packages should DEPEND on mercurial-native
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600617 elif uri.scheme == "hg":
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500618 needsrcrev = True
Andrew Geissler82c905d2020-04-13 13:39:40 -0500619 d.appendVar("EXTRANATIVEPATH", ' python3-native ')
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500620 d.appendVarFlag('do_fetch', 'depends', ' mercurial-native:do_populate_sysroot')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500621
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600622 # Perforce packages support SRCREV = "${AUTOREV}"
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600623 elif uri.scheme == "p4":
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600624 needsrcrev = True
625
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500626 # OSC packages should DEPEND on osc-native
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600627 elif uri.scheme == "osc":
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500628 d.appendVarFlag('do_fetch', 'depends', ' osc-native:do_populate_sysroot')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500629
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600630 elif uri.scheme == "npm":
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500631 d.appendVarFlag('do_fetch', 'depends', ' nodejs-native:do_populate_sysroot')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500632
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500633 # *.lz4 should DEPEND on lz4-native for unpacking
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600634 if uri.path.endswith('.lz4'):
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500635 d.appendVarFlag('do_unpack', 'depends', ' lz4-native:do_populate_sysroot')
636
637 # *.lz should DEPEND on lzip-native for unpacking
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600638 elif uri.path.endswith('.lz'):
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500639 d.appendVarFlag('do_unpack', 'depends', ' lzip-native:do_populate_sysroot')
640
641 # *.xz should DEPEND on xz-native for unpacking
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600642 elif uri.path.endswith('.xz') or uri.path.endswith('.txz'):
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500643 d.appendVarFlag('do_unpack', 'depends', ' xz-native:do_populate_sysroot')
644
645 # .zip should DEPEND on unzip-native for unpacking
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600646 elif uri.path.endswith('.zip') or uri.path.endswith('.jar'):
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500647 d.appendVarFlag('do_unpack', 'depends', ' unzip-native:do_populate_sysroot')
648
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800649 # Some rpm files may be compressed internally using xz (for example, rpms from Fedora)
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600650 elif uri.path.endswith('.rpm'):
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500651 d.appendVarFlag('do_unpack', 'depends', ' xz-native:do_populate_sysroot')
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500652
Brad Bishop316dfdd2018-06-25 12:45:53 -0400653 # *.deb should DEPEND on xz-native for unpacking
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600654 elif uri.path.endswith('.deb'):
Brad Bishop316dfdd2018-06-25 12:45:53 -0400655 d.appendVarFlag('do_unpack', 'depends', ' xz-native:do_populate_sysroot')
656
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500657 if needsrcrev:
658 d.setVar("SRCPV", "${@bb.fetch2.get_srcrev(d)}")
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500659
Brad Bishop15ae2502019-06-18 21:44:24 -0400660 # Gather all named SRCREVs to add to the sstate hash calculation
661 # This anonymous python snippet is called multiple times so we
662 # need to be careful to not double up the appends here and cause
663 # the base hash to mismatch the task hash
664 for uri in srcuri.split():
665 parm = bb.fetch.decodeurl(uri)[5]
666 uri_names = parm.get("name", "").split(",")
667 for uri_name in filter(None, uri_names):
668 srcrev_name = "SRCREV_{}".format(uri_name)
669 if srcrev_name not in (d.getVarFlag("do_fetch", "vardeps") or "").split():
670 d.appendVarFlag("do_fetch", "vardeps", " {}".format(srcrev_name))
671
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500672 set_packagetriplet(d)
673
674 # 'multimachine' handling
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500675 mach_arch = d.getVar('MACHINE_ARCH')
676 pkg_arch = d.getVar('PACKAGE_ARCH')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500677
678 if (pkg_arch == mach_arch):
679 # Already machine specific - nothing further to do
680 return
681
682 #
683 # We always try to scan SRC_URI for urls with machine overrides
684 # unless the package sets SRC_URI_OVERRIDES_PACKAGE_ARCH=0
685 #
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500686 override = d.getVar('SRC_URI_OVERRIDES_PACKAGE_ARCH')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500687 if override != '0':
688 paths = []
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500689 fpaths = (d.getVar('FILESPATH') or '').split(':')
690 machine = d.getVar('MACHINE')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500691 for p in fpaths:
692 if os.path.basename(p) == machine and os.path.isdir(p):
693 paths.append(p)
694
695 if len(paths) != 0:
696 for s in srcuri.split():
697 if not s.startswith("file://"):
698 continue
699 fetcher = bb.fetch2.Fetch([s], d)
700 local = fetcher.localpath(s)
701 for mp in paths:
702 if local.startswith(mp):
703 #bb.note("overriding PACKAGE_ARCH from %s to %s for %s" % (pkg_arch, mach_arch, pn))
704 d.setVar('PACKAGE_ARCH', "${MACHINE_ARCH}")
705 return
706
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500707 packages = d.getVar('PACKAGES').split()
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500708 for pkg in packages:
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500709 pkgarch = d.getVar("PACKAGE_ARCH_%s" % pkg)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500710
711 # We could look for != PACKAGE_ARCH here but how to choose
712 # if multiple differences are present?
713 # Look through PACKAGE_ARCHS for the priority order?
714 if pkgarch and pkgarch == mach_arch:
715 d.setVar('PACKAGE_ARCH', "${MACHINE_ARCH}")
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500716 bb.warn("Recipe %s is marked as only being architecture specific but seems to have machine specific packages?! The recipe may as well mark itself as machine specific directly." % d.getVar("PN"))
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500717}
718
719addtask cleansstate after do_clean
720python do_cleansstate() {
721 sstate_clean_cachefiles(d)
722}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500723addtask cleanall after do_cleansstate
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500724do_cleansstate[nostamp] = "1"
725
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500726python do_cleanall() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500727 src_uri = (d.getVar('SRC_URI') or "").split()
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500728 if len(src_uri) == 0:
729 return
730
731 try:
732 fetcher = bb.fetch2.Fetch(src_uri, d)
733 fetcher.clean()
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600734 except bb.fetch2.BBFetchException as e:
735 bb.fatal(str(e))
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500736}
737do_cleanall[nostamp] = "1"
738
739
740EXPORT_FUNCTIONS do_fetch do_unpack do_configure do_compile do_install do_package