| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | BB_DEFAULT_TASK ?= "build" | 
|  | 2 | CLASSOVERRIDE ?= "class-target" | 
|  | 3 |  | 
|  | 4 | inherit patch | 
|  | 5 | inherit staging | 
|  | 6 |  | 
|  | 7 | inherit mirrors | 
|  | 8 | inherit utils | 
|  | 9 | inherit utility-tasks | 
|  | 10 | inherit metadata_scm | 
|  | 11 | inherit logging | 
|  | 12 |  | 
| Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 13 | OE_EXTRA_IMPORTS ?= "" | 
|  | 14 |  | 
| Andrew Jeffery | ecdf5f1 | 2022-03-01 01:09:46 +1030 | [diff] [blame] | 15 | OE_IMPORTS += "os sys time oe.path oe.utils oe.types oe.package oe.packagegroup oe.sstatesig oe.lsb oe.cachedpath oe.license oe.qa oe.reproducible oe.rust ${OE_EXTRA_IMPORTS}" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 16 | OE_IMPORTS[type] = "list" | 
|  | 17 |  | 
| Brad Bishop | f3fd288 | 2019-06-21 08:06:37 -0400 | [diff] [blame] | 18 | PACKAGECONFIG_CONFARGS ??= "" | 
|  | 19 |  | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 20 | def oe_import(d): | 
|  | 21 | import sys | 
|  | 22 |  | 
| Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 23 | bbpath = [os.path.join(dir, "lib") for dir in d.getVar("BBPATH").split(":")] | 
|  | 24 | sys.path[0:0] = [dir for dir in bbpath if dir not in sys.path] | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 25 |  | 
|  | 26 | import oe.data | 
|  | 27 | for toimport in oe.data.typed_value("OE_IMPORTS", d): | 
| Brad Bishop | 00e122a | 2019-10-05 11:10:57 -0400 | [diff] [blame] | 28 | try: | 
| Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 29 | # Make a python object accessible from the metadata | 
|  | 30 | bb.utils._context[toimport.split(".", 1)[0]] = __import__(toimport) | 
| Brad Bishop | 00e122a | 2019-10-05 11:10:57 -0400 | [diff] [blame] | 31 | except AttributeError as e: | 
|  | 32 | bb.error("Error importing OE modules: %s" % str(e)) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 33 | return "" | 
|  | 34 |  | 
|  | 35 | # We need the oe module name space early (before INHERITs get added) | 
|  | 36 | OE_IMPORTED := "${@oe_import(d)}" | 
|  | 37 |  | 
|  | 38 | def lsb_distro_identifier(d): | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 39 | adjust = d.getVar('LSB_DISTRO_ADJUST') | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 40 | adjust_func = None | 
|  | 41 | if adjust: | 
|  | 42 | try: | 
|  | 43 | adjust_func = globals()[adjust] | 
|  | 44 | except KeyError: | 
|  | 45 | pass | 
|  | 46 | return oe.lsb.distro_identifier(adjust_func) | 
|  | 47 |  | 
|  | 48 | die() { | 
|  | 49 | bbfatal_log "$*" | 
|  | 50 | } | 
|  | 51 |  | 
|  | 52 | oe_runmake_call() { | 
|  | 53 | bbnote ${MAKE} ${EXTRA_OEMAKE} "$@" | 
|  | 54 | ${MAKE} ${EXTRA_OEMAKE} "$@" | 
|  | 55 | } | 
|  | 56 |  | 
|  | 57 | oe_runmake() { | 
|  | 58 | oe_runmake_call "$@" || die "oe_runmake failed" | 
|  | 59 | } | 
|  | 60 |  | 
|  | 61 |  | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 62 | def get_base_dep(d): | 
| Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 63 | if d.getVar('INHIBIT_DEFAULT_DEPS', False): | 
|  | 64 | return "" | 
|  | 65 | return "${BASE_DEFAULT_DEPS}" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 66 |  | 
| Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame] | 67 | BASE_DEFAULT_DEPS = "virtual/${HOST_PREFIX}gcc virtual/${HOST_PREFIX}compilerlibs virtual/libc" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 68 |  | 
| Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 69 | BASEDEPENDS = "" | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 70 | BASEDEPENDS:class-target = "${@get_base_dep(d)}" | 
|  | 71 | BASEDEPENDS:class-nativesdk = "${@get_base_dep(d)}" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 72 |  | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 73 | DEPENDS:prepend="${BASEDEPENDS} " | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 74 |  | 
|  | 75 | FILESPATH = "${@base_set_filespath(["${FILE_DIRNAME}/${BP}", "${FILE_DIRNAME}/${BPN}", "${FILE_DIRNAME}/files"], d)}" | 
|  | 76 | # THISDIR only works properly with imediate expansion as it has to run | 
|  | 77 | # in the context of the location its used (:=) | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 78 | THISDIR = "${@os.path.dirname(d.getVar('FILE'))}" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 79 |  | 
|  | 80 | def extra_path_elements(d): | 
|  | 81 | path = "" | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 82 | elements = (d.getVar('EXTRANATIVEPATH') or "").split() | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 83 | for e in elements: | 
|  | 84 | path = path + "${STAGING_BINDIR_NATIVE}/" + e + ":" | 
|  | 85 | return path | 
|  | 86 |  | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 87 | PATH:prepend = "${@extra_path_elements(d)}" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 88 |  | 
|  | 89 | def get_lic_checksum_file_list(d): | 
|  | 90 | filelist = [] | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 91 | lic_files = d.getVar("LIC_FILES_CHKSUM") or '' | 
|  | 92 | tmpdir = d.getVar("TMPDIR") | 
|  | 93 | s = d.getVar("S") | 
|  | 94 | b = d.getVar("B") | 
|  | 95 | workdir = d.getVar("WORKDIR") | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 96 |  | 
|  | 97 | urls = lic_files.split() | 
|  | 98 | for url in urls: | 
|  | 99 | # We only care about items that are absolute paths since | 
|  | 100 | # any others should be covered by SRC_URI. | 
|  | 101 | try: | 
| Brad Bishop | 220d553 | 2018-08-14 00:59:39 +0100 | [diff] [blame] | 102 | (method, host, path, user, pswd, parm) = bb.fetch.decodeurl(url) | 
|  | 103 | if method != "file" or not path: | 
| Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 104 | raise bb.fetch.MalformedUrl(url) | 
|  | 105 |  | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 106 | if path[0] == '/': | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 107 | if path.startswith((tmpdir, s, b, workdir)): | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 108 | continue | 
|  | 109 | filelist.append(path + ":" + str(os.path.exists(path))) | 
|  | 110 | except bb.fetch.MalformedUrl: | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 111 | bb.fatal(d.getVar('PN') + ": LIC_FILES_CHKSUM contains an invalid URL: " + url) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 112 | return " ".join(filelist) | 
|  | 113 |  | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 114 | def setup_hosttools_dir(dest, toolsvar, d, fatal=True): | 
|  | 115 | tools = d.getVar(toolsvar).split() | 
|  | 116 | origbbenv = d.getVar("BB_ORIGENV", False) | 
|  | 117 | path = origbbenv.getVar("PATH") | 
| Andrew Geissler | d583833 | 2022-05-27 11:33:10 -0500 | [diff] [blame] | 118 | # Need to ignore our own scripts directories to avoid circular links | 
|  | 119 | for p in path.split(":"): | 
|  | 120 | if p.endswith("/scripts"): | 
|  | 121 | path = path.replace(p, "/ignoreme") | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 122 | bb.utils.mkdirhier(dest) | 
|  | 123 | notfound = [] | 
|  | 124 | for tool in tools: | 
|  | 125 | desttool = os.path.join(dest, tool) | 
|  | 126 | if not os.path.exists(desttool): | 
| Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 127 | # clean up dead symlink | 
|  | 128 | if os.path.islink(desttool): | 
|  | 129 | os.unlink(desttool) | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 130 | srctool = bb.utils.which(path, tool, executable=True) | 
| Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 131 | # gcc/g++ may link to ccache on some hosts, e.g., | 
|  | 132 | # /usr/local/bin/ccache/gcc -> /usr/bin/ccache, then which(gcc) | 
|  | 133 | # would return /usr/local/bin/ccache/gcc, but what we need is | 
|  | 134 | # /usr/bin/gcc, this code can check and fix that. | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 135 | if "ccache" in srctool: | 
|  | 136 | srctool = bb.utils.which(path, tool, executable=True, direction=1) | 
|  | 137 | if srctool: | 
|  | 138 | os.symlink(srctool, desttool) | 
|  | 139 | else: | 
|  | 140 | notfound.append(tool) | 
| Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 141 |  | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 142 | if notfound and fatal: | 
|  | 143 | 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)) | 
|  | 144 |  | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 145 | addtask fetch | 
|  | 146 | do_fetch[dirs] = "${DL_DIR}" | 
|  | 147 | do_fetch[file-checksums] = "${@bb.fetch.get_checksum_file_list(d)}" | 
|  | 148 | do_fetch[file-checksums] += " ${@get_lic_checksum_file_list(d)}" | 
|  | 149 | do_fetch[vardeps] += "SRCREV" | 
| Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 150 | do_fetch[network] = "1" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 151 | python base_do_fetch() { | 
|  | 152 |  | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 153 | src_uri = (d.getVar('SRC_URI') or "").split() | 
| Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 154 | if not src_uri: | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 155 | return | 
|  | 156 |  | 
|  | 157 | try: | 
|  | 158 | fetcher = bb.fetch2.Fetch(src_uri, d) | 
|  | 159 | fetcher.download() | 
|  | 160 | except bb.fetch2.BBFetchException as e: | 
| Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 161 | bb.fatal("Bitbake Fetcher Error: " + repr(e)) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 162 | } | 
|  | 163 |  | 
|  | 164 | addtask unpack after do_fetch | 
|  | 165 | do_unpack[dirs] = "${WORKDIR}" | 
| Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 166 |  | 
| Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 167 | do_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 Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 168 |  | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 169 | python base_do_unpack() { | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 170 | src_uri = (d.getVar('SRC_URI') or "").split() | 
| Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 171 | if not src_uri: | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 172 | return | 
|  | 173 |  | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 174 | try: | 
|  | 175 | fetcher = bb.fetch2.Fetch(src_uri, d) | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 176 | fetcher.unpack(d.getVar('WORKDIR')) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 177 | except bb.fetch2.BBFetchException as e: | 
| Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 178 | bb.fatal("Bitbake Fetcher Error: " + repr(e)) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 179 | } | 
|  | 180 |  | 
| Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 181 | SSTATETASKS += "do_deploy_source_date_epoch" | 
|  | 182 |  | 
|  | 183 | do_deploy_source_date_epoch () { | 
|  | 184 | mkdir -p ${SDE_DEPLOYDIR} | 
|  | 185 | if [ -e ${SDE_FILE} ]; then | 
|  | 186 | echo "Deploying SDE from ${SDE_FILE} -> ${SDE_DEPLOYDIR}." | 
|  | 187 | cp -p ${SDE_FILE} ${SDE_DEPLOYDIR}/__source_date_epoch.txt | 
|  | 188 | else | 
|  | 189 | echo "${SDE_FILE} not found!" | 
|  | 190 | fi | 
|  | 191 | } | 
|  | 192 |  | 
|  | 193 | python do_deploy_source_date_epoch_setscene () { | 
|  | 194 | sstate_setscene(d) | 
|  | 195 | bb.utils.mkdirhier(d.getVar('SDE_DIR')) | 
|  | 196 | sde_file = os.path.join(d.getVar('SDE_DEPLOYDIR'), '__source_date_epoch.txt') | 
|  | 197 | if os.path.exists(sde_file): | 
|  | 198 | target = d.getVar('SDE_FILE') | 
|  | 199 | bb.debug(1, "Moving setscene SDE file %s -> %s" % (sde_file, target)) | 
|  | 200 | bb.utils.rename(sde_file, target) | 
|  | 201 | else: | 
|  | 202 | bb.debug(1, "%s not found!" % sde_file) | 
|  | 203 | } | 
|  | 204 |  | 
|  | 205 | do_deploy_source_date_epoch[dirs] = "${SDE_DEPLOYDIR}" | 
|  | 206 | do_deploy_source_date_epoch[sstate-plaindirs] = "${SDE_DEPLOYDIR}" | 
|  | 207 | addtask do_deploy_source_date_epoch_setscene | 
|  | 208 | addtask do_deploy_source_date_epoch before do_configure after do_patch | 
|  | 209 |  | 
|  | 210 | python create_source_date_epoch_stamp() { | 
|  | 211 | source_date_epoch = oe.reproducible.get_source_date_epoch(d, d.getVar('S')) | 
|  | 212 | oe.reproducible.epochfile_write(source_date_epoch, d.getVar('SDE_FILE'), d) | 
|  | 213 | } | 
|  | 214 | do_unpack[postfuncs] += "create_source_date_epoch_stamp" | 
|  | 215 |  | 
|  | 216 | def get_source_date_epoch_value(d): | 
|  | 217 | return oe.reproducible.epochfile_read(d.getVar('SDE_FILE'), d) | 
|  | 218 |  | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 219 | def get_layers_branch_rev(d): | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 220 | layers = (d.getVar("BBLAYERS") or "").split() | 
| Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 221 | layers_branch_rev = ["%-20s = \"%s:%s\"" % (os.path.basename(i), \ | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 222 | base_get_metadata_git_branch(i, None).strip(), \ | 
|  | 223 | base_get_metadata_git_revision(i, None)) \ | 
|  | 224 | for i in layers] | 
|  | 225 | i = len(layers_branch_rev)-1 | 
|  | 226 | p1 = layers_branch_rev[i].find("=") | 
|  | 227 | s1 = layers_branch_rev[i][p1:] | 
|  | 228 | while i > 0: | 
|  | 229 | p2 = layers_branch_rev[i-1].find("=") | 
|  | 230 | s2= layers_branch_rev[i-1][p2:] | 
|  | 231 | if s1 == s2: | 
|  | 232 | layers_branch_rev[i-1] = layers_branch_rev[i-1][0:p2] | 
|  | 233 | i -= 1 | 
|  | 234 | else: | 
|  | 235 | i -= 1 | 
|  | 236 | p1 = layers_branch_rev[i].find("=") | 
|  | 237 | s1= layers_branch_rev[i][p1:] | 
|  | 238 | return layers_branch_rev | 
|  | 239 |  | 
|  | 240 |  | 
|  | 241 | BUILDCFG_FUNCS ??= "buildcfg_vars get_layers_branch_rev buildcfg_neededvars" | 
|  | 242 | BUILDCFG_FUNCS[type] = "list" | 
|  | 243 |  | 
|  | 244 | def buildcfg_vars(d): | 
|  | 245 | statusvars = oe.data.typed_value('BUILDCFG_VARS', d) | 
|  | 246 | for var in statusvars: | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 247 | value = d.getVar(var) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 248 | if value is not None: | 
| Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 249 | yield '%-20s = "%s"' % (var, value) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 250 |  | 
|  | 251 | def buildcfg_neededvars(d): | 
|  | 252 | needed_vars = oe.data.typed_value("BUILDCFG_NEEDEDVARS", d) | 
|  | 253 | pesteruser = [] | 
|  | 254 | for v in needed_vars: | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 255 | val = d.getVar(v) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 256 | if not val or val == 'INVALID': | 
|  | 257 | pesteruser.append(v) | 
|  | 258 |  | 
|  | 259 | if pesteruser: | 
|  | 260 | 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)) | 
|  | 261 |  | 
|  | 262 | addhandler base_eventhandler | 
| Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 263 | base_eventhandler[eventmask] = "bb.event.ConfigParsed bb.event.MultiConfigParsed bb.event.BuildStarted bb.event.RecipePreFinalise bb.event.RecipeParsed" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 264 | python base_eventhandler() { | 
|  | 265 | import bb.runqueue | 
|  | 266 |  | 
|  | 267 | if isinstance(e, bb.event.ConfigParsed): | 
| Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 268 | if not d.getVar("NATIVELSBSTRING", False): | 
|  | 269 | d.setVar("NATIVELSBSTRING", lsb_distro_identifier(d)) | 
| Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 270 | d.setVar("ORIGNATIVELSBSTRING", d.getVar("NATIVELSBSTRING", False)) | 
| Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 271 | d.setVar('BB_VERSION', bb.__version__) | 
| Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 272 |  | 
|  | 273 | # There might be no bb.event.ConfigParsed event if bitbake server is | 
|  | 274 | # running, so check bb.event.BuildStarted too to make sure ${HOSTTOOLS_DIR} | 
|  | 275 | # exists. | 
|  | 276 | if isinstance(e, bb.event.ConfigParsed) or \ | 
|  | 277 | (isinstance(e, bb.event.BuildStarted) and not os.path.exists(d.getVar('HOSTTOOLS_DIR'))): | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 278 | # Works with the line in layer.conf which changes PATH to point here | 
|  | 279 | setup_hosttools_dir(d.getVar('HOSTTOOLS_DIR'), 'HOSTTOOLS', d) | 
|  | 280 | setup_hosttools_dir(d.getVar('HOSTTOOLS_DIR'), 'HOSTTOOLS_NONFATAL', d, fatal=False) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 281 |  | 
| Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 282 | if isinstance(e, bb.event.MultiConfigParsed): | 
|  | 283 | # We need to expand SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS in each of the multiconfig data stores | 
|  | 284 | # own contexts so the variables get expanded correctly for that arch, then inject back into | 
|  | 285 | # the main data store. | 
|  | 286 | deps = [] | 
|  | 287 | for config in e.mcdata: | 
|  | 288 | deps.append(e.mcdata[config].getVar("SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS")) | 
|  | 289 | deps = " ".join(deps) | 
|  | 290 | e.mcdata[''].setVar("SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS", deps) | 
|  | 291 |  | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 292 | if isinstance(e, bb.event.BuildStarted): | 
| Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 293 | localdata = bb.data.createCopy(d) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 294 | statuslines = [] | 
|  | 295 | for func in oe.data.typed_value('BUILDCFG_FUNCS', localdata): | 
|  | 296 | g = globals() | 
|  | 297 | if func not in g: | 
|  | 298 | bb.warn("Build configuration function '%s' does not exist" % func) | 
|  | 299 | else: | 
|  | 300 | flines = g[func](localdata) | 
|  | 301 | if flines: | 
|  | 302 | statuslines.extend(flines) | 
|  | 303 |  | 
| Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 304 | statusheader = d.getVar('BUILDCFG_HEADER') | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 305 | if statusheader: | 
|  | 306 | bb.plain('\n%s\n%s\n' % (statusheader, '\n'.join(statuslines))) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 307 |  | 
|  | 308 | # This code is to silence warnings where the SDK variables overwrite the | 
|  | 309 | # target ones and we'd see dulpicate key names overwriting each other | 
|  | 310 | # for various PREFERRED_PROVIDERS | 
|  | 311 | if isinstance(e, bb.event.RecipePreFinalise): | 
| Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 312 | if d.getVar("TARGET_PREFIX") == d.getVar("SDK_PREFIX"): | 
|  | 313 | d.delVar("PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}binutils") | 
| Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 314 | d.delVar("PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc") | 
|  | 315 | d.delVar("PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}g++") | 
|  | 316 | d.delVar("PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}compilerlibs") | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 317 |  | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 318 | if isinstance(e, bb.event.RecipeParsed): | 
|  | 319 | # | 
|  | 320 | # If we have multiple providers of virtual/X and a PREFERRED_PROVIDER_virtual/X is set | 
|  | 321 | # skip parsing for all the other providers which will mean they get uninstalled from the | 
|  | 322 | # sysroot since they're now "unreachable". This makes switching virtual/kernel work in | 
|  | 323 | # particular. | 
|  | 324 | # | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 325 | pn = d.getVar('PN') | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 326 | source_mirror_fetch = d.getVar('SOURCE_MIRROR_FETCH', False) | 
|  | 327 | if not source_mirror_fetch: | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 328 | provs = (d.getVar("PROVIDES") or "").split() | 
| Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 329 | multiprovidersallowed = (d.getVar("BB_MULTI_PROVIDER_ALLOWED") or "").split() | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 330 | for p in provs: | 
| Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 331 | if p.startswith("virtual/") and p not in multiprovidersallowed: | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 332 | profprov = d.getVar("PREFERRED_PROVIDER_" + p) | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 333 | if profprov and pn != profprov: | 
| Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 334 | raise bb.parse.SkipRecipe("PREFERRED_PROVIDER_%s set to %s, not %s" % (p, profprov, pn)) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 335 | } | 
|  | 336 |  | 
|  | 337 | CONFIGURESTAMPFILE = "${WORKDIR}/configure.sstate" | 
|  | 338 | CLEANBROKEN = "0" | 
|  | 339 |  | 
|  | 340 | addtask configure after do_patch | 
|  | 341 | do_configure[dirs] = "${B}" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 342 | base_do_configure() { | 
|  | 343 | if [ -n "${CONFIGURESTAMPFILE}" -a -e "${CONFIGURESTAMPFILE}" ]; then | 
|  | 344 | if [ "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" ]; then | 
|  | 345 | cd ${B} | 
|  | 346 | if [ "${CLEANBROKEN}" != "1" -a \( -e Makefile -o -e makefile -o -e GNUmakefile \) ]; then | 
|  | 347 | oe_runmake clean | 
|  | 348 | fi | 
| Brad Bishop | c4ea075 | 2018-11-15 14:30:15 -0800 | [diff] [blame] | 349 | # -ignore_readdir_race does not work correctly with -delete; | 
|  | 350 | # use xargs to avoid spurious build failures | 
|  | 351 | find ${B} -ignore_readdir_race -name \*.la -type f -print0 | xargs -0 rm -f | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 352 | fi | 
|  | 353 | fi | 
|  | 354 | if [ -n "${CONFIGURESTAMPFILE}" ]; then | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 355 | mkdir -p `dirname ${CONFIGURESTAMPFILE}` | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 356 | echo ${BB_TASKHASH} > ${CONFIGURESTAMPFILE} | 
|  | 357 | fi | 
|  | 358 | } | 
|  | 359 |  | 
|  | 360 | addtask compile after do_configure | 
|  | 361 | do_compile[dirs] = "${B}" | 
|  | 362 | base_do_compile() { | 
|  | 363 | if [ -e Makefile -o -e makefile -o -e GNUmakefile ]; then | 
|  | 364 | oe_runmake || die "make failed" | 
|  | 365 | else | 
|  | 366 | bbnote "nothing to compile" | 
|  | 367 | fi | 
|  | 368 | } | 
|  | 369 |  | 
|  | 370 | addtask install after do_compile | 
| Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 371 | do_install[dirs] = "${B}" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 372 | # Remove and re-create ${D} so that is it guaranteed to be empty | 
|  | 373 | do_install[cleandirs] = "${D}" | 
|  | 374 |  | 
|  | 375 | base_do_install() { | 
|  | 376 | : | 
|  | 377 | } | 
|  | 378 |  | 
|  | 379 | base_do_package() { | 
|  | 380 | : | 
|  | 381 | } | 
|  | 382 |  | 
|  | 383 | addtask build after do_populate_sysroot | 
|  | 384 | do_build[noexec] = "1" | 
|  | 385 | do_build[recrdeptask] += "do_deploy" | 
|  | 386 | do_build () { | 
|  | 387 | : | 
|  | 388 | } | 
|  | 389 |  | 
|  | 390 | def set_packagetriplet(d): | 
|  | 391 | archs = [] | 
|  | 392 | tos = [] | 
|  | 393 | tvs = [] | 
|  | 394 |  | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 395 | archs.append(d.getVar("PACKAGE_ARCHS").split()) | 
|  | 396 | tos.append(d.getVar("TARGET_OS")) | 
|  | 397 | tvs.append(d.getVar("TARGET_VENDOR")) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 398 |  | 
|  | 399 | def settriplet(d, varname, archs, tos, tvs): | 
|  | 400 | triplets = [] | 
|  | 401 | for i in range(len(archs)): | 
|  | 402 | for arch in archs[i]: | 
|  | 403 | triplets.append(arch + tvs[i] + "-" + tos[i]) | 
|  | 404 | triplets.reverse() | 
|  | 405 | d.setVar(varname, " ".join(triplets)) | 
|  | 406 |  | 
|  | 407 | settriplet(d, "PKGTRIPLETS", archs, tos, tvs) | 
|  | 408 |  | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 409 | variants = d.getVar("MULTILIB_VARIANTS") or "" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 410 | for item in variants.split(): | 
|  | 411 | localdata = bb.data.createCopy(d) | 
|  | 412 | overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + item | 
|  | 413 | localdata.setVar("OVERRIDES", overrides) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 414 |  | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 415 | archs.append(localdata.getVar("PACKAGE_ARCHS").split()) | 
|  | 416 | tos.append(localdata.getVar("TARGET_OS")) | 
|  | 417 | tvs.append(localdata.getVar("TARGET_VENDOR")) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 418 |  | 
|  | 419 | settriplet(d, "PKGMLTRIPLETS", archs, tos, tvs) | 
|  | 420 |  | 
|  | 421 | python () { | 
|  | 422 | import string, re | 
|  | 423 |  | 
| Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 424 | # Handle backfilling | 
|  | 425 | oe.utils.features_backfill("DISTRO_FEATURES", d) | 
|  | 426 | oe.utils.features_backfill("MACHINE_FEATURES", d) | 
|  | 427 |  | 
| Andrew Geissler | f034379 | 2020-11-18 10:42:21 -0600 | [diff] [blame] | 428 | if d.getVar("S")[-1] == '/': | 
|  | 429 | bb.warn("Recipe %s sets S variable with trailing slash '%s', remove it" % (d.getVar("PN"), d.getVar("S"))) | 
|  | 430 | if d.getVar("B")[-1] == '/': | 
|  | 431 | bb.warn("Recipe %s sets B variable with trailing slash '%s', remove it" % (d.getVar("PN"), d.getVar("B"))) | 
|  | 432 |  | 
|  | 433 | if os.path.normpath(d.getVar("WORKDIR")) != os.path.normpath(d.getVar("S")): | 
|  | 434 | d.appendVar("PSEUDO_IGNORE_PATHS", ",${S}") | 
|  | 435 | if os.path.normpath(d.getVar("WORKDIR")) != os.path.normpath(d.getVar("B")): | 
|  | 436 | d.appendVar("PSEUDO_IGNORE_PATHS", ",${B}") | 
|  | 437 |  | 
| Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame] | 438 | # To add a recipe to the skip list , set: | 
|  | 439 | #   SKIP_RECIPE[pn] = "message" | 
|  | 440 | pn = d.getVar('PN') | 
|  | 441 | skip_msg = d.getVarFlag('SKIP_RECIPE', pn) | 
|  | 442 | if skip_msg: | 
|  | 443 | bb.debug(1, "Skipping %s %s" % (pn, skip_msg)) | 
|  | 444 | raise bb.parse.SkipRecipe("Recipe will be skipped because: %s" % (skip_msg)) | 
|  | 445 |  | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 446 | # Handle PACKAGECONFIG | 
|  | 447 | # | 
|  | 448 | # These take the form: | 
|  | 449 | # | 
|  | 450 | # PACKAGECONFIG ??= "<default options>" | 
| Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 451 | # PACKAGECONFIG[foo] = "--enable-foo,--disable-foo,foo_depends,foo_runtime_depends,foo_runtime_recommends,foo_conflict_packageconfig" | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 452 | pkgconfigflags = d.getVarFlags("PACKAGECONFIG") or {} | 
|  | 453 | if pkgconfigflags: | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 454 | pkgconfig = (d.getVar('PACKAGECONFIG') or "").split() | 
|  | 455 | pn = d.getVar("PN") | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 456 |  | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 457 | mlprefix = d.getVar("MLPREFIX") | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 458 |  | 
|  | 459 | def expandFilter(appends, extension, prefix): | 
|  | 460 | appends = bb.utils.explode_deps(d.expand(" ".join(appends))) | 
|  | 461 | newappends = [] | 
|  | 462 | for a in appends: | 
|  | 463 | if a.endswith("-native") or ("-cross-" in a): | 
|  | 464 | newappends.append(a) | 
|  | 465 | elif a.startswith("virtual/"): | 
|  | 466 | subs = a.split("/", 1)[1] | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 467 | if subs.startswith(prefix): | 
|  | 468 | newappends.append(a + extension) | 
|  | 469 | else: | 
|  | 470 | newappends.append("virtual/" + prefix + subs + extension) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 471 | else: | 
|  | 472 | if a.startswith(prefix): | 
|  | 473 | newappends.append(a + extension) | 
|  | 474 | else: | 
|  | 475 | newappends.append(prefix + a + extension) | 
|  | 476 | return newappends | 
|  | 477 |  | 
|  | 478 | def appendVar(varname, appends): | 
|  | 479 | if not appends: | 
|  | 480 | return | 
|  | 481 | if varname.find("DEPENDS") != -1: | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 482 | if bb.data.inherits_class('nativesdk', d) or bb.data.inherits_class('cross-canadian', d) : | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 483 | appends = expandFilter(appends, "", "nativesdk-") | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 484 | elif bb.data.inherits_class('native', d): | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 485 | appends = expandFilter(appends, "-native", "") | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 486 | elif mlprefix: | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 487 | appends = expandFilter(appends, "", mlprefix) | 
|  | 488 | varname = d.expand(varname) | 
|  | 489 | d.appendVar(varname, " " + " ".join(appends)) | 
|  | 490 |  | 
|  | 491 | extradeps = [] | 
|  | 492 | extrardeps = [] | 
| Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 493 | extrarrecs = [] | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 494 | extraconf = [] | 
|  | 495 | for flag, flagval in sorted(pkgconfigflags.items()): | 
|  | 496 | items = flagval.split(",") | 
|  | 497 | num = len(items) | 
| Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 498 | if num > 6: | 
|  | 499 | bb.error("%s: PACKAGECONFIG[%s] Only enable,disable,depend,rdepend,rrecommend,conflict_packageconfig can be specified!" | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 500 | % (d.getVar('PN'), flag)) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 501 |  | 
|  | 502 | if flag in pkgconfig: | 
|  | 503 | if num >= 3 and items[2]: | 
|  | 504 | extradeps.append(items[2]) | 
|  | 505 | if num >= 4 and items[3]: | 
|  | 506 | extrardeps.append(items[3]) | 
| Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 507 | if num >= 5 and items[4]: | 
|  | 508 | extrarrecs.append(items[4]) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 509 | if num >= 1 and items[0]: | 
|  | 510 | extraconf.append(items[0]) | 
|  | 511 | elif num >= 2 and items[1]: | 
|  | 512 | extraconf.append(items[1]) | 
| Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 513 |  | 
|  | 514 | if num >= 6 and items[5]: | 
|  | 515 | conflicts = set(items[5].split()) | 
|  | 516 | invalid = conflicts.difference(set(pkgconfigflags.keys())) | 
|  | 517 | if invalid: | 
|  | 518 | bb.error("%s: PACKAGECONFIG[%s] Invalid conflict package config%s '%s' specified." | 
|  | 519 | % (d.getVar('PN'), flag, 's' if len(invalid) > 1 else '', ' '.join(invalid))) | 
|  | 520 |  | 
|  | 521 | if flag in pkgconfig: | 
|  | 522 | intersec = conflicts.intersection(set(pkgconfig)) | 
|  | 523 | if intersec: | 
|  | 524 | bb.fatal("%s: PACKAGECONFIG[%s] Conflict package config%s '%s' set in PACKAGECONFIG." | 
|  | 525 | % (d.getVar('PN'), flag, 's' if len(intersec) > 1 else '', ' '.join(intersec))) | 
|  | 526 |  | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 527 | appendVar('DEPENDS', extradeps) | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 528 | appendVar('RDEPENDS:${PN}', extrardeps) | 
|  | 529 | appendVar('RRECOMMENDS:${PN}', extrarrecs) | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 530 | appendVar('PACKAGECONFIG_CONFARGS', extraconf) | 
|  | 531 |  | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 532 | pn = d.getVar('PN') | 
|  | 533 | license = d.getVar('LICENSE') | 
| Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 534 | if license == "INVALID" and pn != "defaultpkgname": | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 535 | bb.fatal('This recipe does not have the LICENSE field set (%s)' % pn) | 
|  | 536 |  | 
|  | 537 | if bb.data.inherits_class('license', d): | 
|  | 538 | check_license_format(d) | 
| Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 539 | unmatched_license_flags = check_license_flags(d) | 
|  | 540 | if unmatched_license_flags: | 
|  | 541 | if len(unmatched_license_flags) == 1: | 
| Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame] | 542 | message = "because it has a restricted license '{0}'. Which is not listed in LICENSE_FLAGS_ACCEPTED".format(unmatched_license_flags[0]) | 
| Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 543 | else: | 
| Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame] | 544 | message = "because it has restricted licenses {0}. Which are not listed in LICENSE_FLAGS_ACCEPTED".format( | 
| Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 545 | ", ".join("'{0}'".format(f) for f in unmatched_license_flags)) | 
|  | 546 | bb.debug(1, "Skipping %s %s" % (pn, message)) | 
|  | 547 | raise bb.parse.SkipRecipe(message) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 548 |  | 
|  | 549 | # If we're building a target package we need to use fakeroot (pseudo) | 
|  | 550 | # in order to capture permissions, owners, groups and special files | 
|  | 551 | if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d): | 
| Brad Bishop | 64c979e | 2019-11-04 13:55:29 -0500 | [diff] [blame] | 552 | d.appendVarFlag('do_prepare_recipe_sysroot', 'depends', ' virtual/fakeroot-native:do_populate_sysroot') | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 553 | d.appendVarFlag('do_install', 'depends', ' virtual/fakeroot-native:do_populate_sysroot') | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 554 | d.setVarFlag('do_install', 'fakeroot', '1') | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 555 | d.appendVarFlag('do_package', 'depends', ' virtual/fakeroot-native:do_populate_sysroot') | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 556 | d.setVarFlag('do_package', 'fakeroot', '1') | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 557 | d.setVarFlag('do_package_setscene', 'fakeroot', '1') | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 558 | d.appendVarFlag('do_package_setscene', 'depends', ' virtual/fakeroot-native:do_populate_sysroot') | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 559 | d.setVarFlag('do_devshell', 'fakeroot', '1') | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 560 | d.appendVarFlag('do_devshell', 'depends', ' virtual/fakeroot-native:do_populate_sysroot') | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 561 |  | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 562 | need_machine = d.getVar('COMPATIBLE_MACHINE') | 
| Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 563 | if need_machine and not d.getVar('PARSE_ALL_RECIPES', False): | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 564 | import re | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 565 | compat_machines = (d.getVar('MACHINEOVERRIDES') or "").split(":") | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 566 | for m in compat_machines: | 
|  | 567 | if re.match(need_machine, m): | 
|  | 568 | break | 
|  | 569 | else: | 
| Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 570 | raise bb.parse.SkipRecipe("incompatible with machine %s (not in COMPATIBLE_MACHINE)" % d.getVar('MACHINE')) | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 571 |  | 
| Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 572 | source_mirror_fetch = d.getVar('SOURCE_MIRROR_FETCH', False) or d.getVar('PARSE_ALL_RECIPES', False) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 573 | if not source_mirror_fetch: | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 574 | need_host = d.getVar('COMPATIBLE_HOST') | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 575 | if need_host: | 
|  | 576 | import re | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 577 | this_host = d.getVar('HOST_SYS') | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 578 | if not re.match(need_host, this_host): | 
| Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 579 | raise bb.parse.SkipRecipe("incompatible with host %s (not in COMPATIBLE_HOST)" % this_host) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 580 |  | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 581 | bad_licenses = (d.getVar('INCOMPATIBLE_LICENSE') or "").split() | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 582 |  | 
|  | 583 | check_license = False if pn.startswith("nativesdk-") else True | 
|  | 584 | for t in ["-native", "-cross-${TARGET_ARCH}", "-cross-initial-${TARGET_ARCH}", | 
| Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 585 | "-crosssdk-${SDK_SYS}", "-crosssdk-initial-${SDK_SYS}", | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 586 | "-cross-canadian-${TRANSLATED_TARGET_ARCH}"]: | 
|  | 587 | if pn.endswith(d.expand(t)): | 
|  | 588 | check_license = False | 
|  | 589 | if pn.startswith("gcc-source-"): | 
|  | 590 | check_license = False | 
|  | 591 |  | 
|  | 592 | if check_license and bad_licenses: | 
|  | 593 | bad_licenses = expand_wildcard_licenses(d, bad_licenses) | 
|  | 594 |  | 
| Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 595 | exceptions = (d.getVar("INCOMPATIBLE_LICENSE_EXCEPTIONS") or "").split() | 
| Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 596 |  | 
| Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 597 | for lic_exception in exceptions: | 
|  | 598 | if ":" in lic_exception: | 
|  | 599 | lic_exception.split(":")[0] | 
|  | 600 | if lic_exception in oe.license.obsolete_license_list(): | 
|  | 601 | bb.fatal("Invalid license %s used in INCOMPATIBLE_LICENSE_EXCEPTIONS" % lic_exception) | 
|  | 602 |  | 
|  | 603 | pkgs = d.getVar('PACKAGES').split() | 
|  | 604 | skipped_pkgs = {} | 
|  | 605 | unskipped_pkgs = [] | 
|  | 606 | for pkg in pkgs: | 
|  | 607 | remaining_bad_licenses = oe.license.apply_pkg_license_exception(pkg, bad_licenses, exceptions) | 
|  | 608 |  | 
|  | 609 | incompatible_lic = incompatible_license(d, remaining_bad_licenses, pkg) | 
|  | 610 | if incompatible_lic: | 
|  | 611 | skipped_pkgs[pkg] = incompatible_lic | 
| Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 612 | else: | 
| Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 613 | unskipped_pkgs.append(pkg) | 
| Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 614 |  | 
| Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 615 | if unskipped_pkgs: | 
|  | 616 | for pkg in skipped_pkgs: | 
|  | 617 | bb.debug(1, "Skipping the package %s at do_rootfs because of incompatible license(s): %s" % (pkg, ' '.join(skipped_pkgs[pkg]))) | 
|  | 618 | d.setVar('_exclude_incompatible-' + pkg, ' '.join(skipped_pkgs[pkg])) | 
|  | 619 | for pkg in unskipped_pkgs: | 
|  | 620 | bb.debug(1, "Including the package %s" % pkg) | 
|  | 621 | else: | 
|  | 622 | incompatible_lic = incompatible_license(d, bad_licenses) | 
|  | 623 | for pkg in skipped_pkgs: | 
|  | 624 | incompatible_lic += skipped_pkgs[pkg] | 
|  | 625 | incompatible_lic = sorted(list(set(incompatible_lic))) | 
|  | 626 |  | 
|  | 627 | if incompatible_lic: | 
|  | 628 | bb.debug(1, "Skipping recipe %s because of incompatible license(s): %s" % (pn, ' '.join(incompatible_lic))) | 
|  | 629 | raise bb.parse.SkipRecipe("it has incompatible license(s): %s" % ' '.join(incompatible_lic)) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 630 |  | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 631 | needsrcrev = False | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 632 | srcuri = d.getVar('SRC_URI') | 
| Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 633 | for uri_string in srcuri.split(): | 
|  | 634 | uri = bb.fetch.URI(uri_string) | 
| Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 635 | # Also check downloadfilename as the URL path might not be useful for sniffing | 
|  | 636 | path = uri.params.get("downloadfilename", uri.path) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 637 |  | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 638 | # HTTP/FTP use the wget fetcher | 
| Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 639 | if uri.scheme in ("http", "https", "ftp"): | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 640 | d.appendVarFlag('do_fetch', 'depends', ' wget-native:do_populate_sysroot') | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 641 |  | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 642 | # Svn packages should DEPEND on subversion-native | 
| Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 643 | if uri.scheme == "svn": | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 644 | needsrcrev = True | 
|  | 645 | d.appendVarFlag('do_fetch', 'depends', ' subversion-native:do_populate_sysroot') | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 646 |  | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 647 | # Git packages should DEPEND on git-native | 
| Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 648 | elif uri.scheme in ("git", "gitsm"): | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 649 | needsrcrev = True | 
|  | 650 | d.appendVarFlag('do_fetch', 'depends', ' git-native:do_populate_sysroot') | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 651 |  | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 652 | # Mercurial packages should DEPEND on mercurial-native | 
| Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 653 | elif uri.scheme == "hg": | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 654 | needsrcrev = True | 
| Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 655 | d.appendVar("EXTRANATIVEPATH", ' python3-native ') | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 656 | d.appendVarFlag('do_fetch', 'depends', ' mercurial-native:do_populate_sysroot') | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 657 |  | 
| Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 658 | # Perforce packages support SRCREV = "${AUTOREV}" | 
| Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 659 | elif uri.scheme == "p4": | 
| Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 660 | needsrcrev = True | 
|  | 661 |  | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 662 | # OSC packages should DEPEND on osc-native | 
| Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 663 | elif uri.scheme == "osc": | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 664 | d.appendVarFlag('do_fetch', 'depends', ' osc-native:do_populate_sysroot') | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 665 |  | 
| Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 666 | elif uri.scheme == "npm": | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 667 | d.appendVarFlag('do_fetch', 'depends', ' nodejs-native:do_populate_sysroot') | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 668 |  | 
| Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 669 | elif uri.scheme == "repo": | 
|  | 670 | needsrcrev = True | 
|  | 671 | d.appendVarFlag('do_fetch', 'depends', ' repo-native:do_populate_sysroot') | 
|  | 672 |  | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 673 | # *.lz4 should DEPEND on lz4-native for unpacking | 
| Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 674 | if path.endswith('.lz4'): | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 675 | d.appendVarFlag('do_unpack', 'depends', ' lz4-native:do_populate_sysroot') | 
|  | 676 |  | 
| Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 677 | # *.zst should DEPEND on zstd-native for unpacking | 
|  | 678 | elif path.endswith('.zst'): | 
|  | 679 | d.appendVarFlag('do_unpack', 'depends', ' zstd-native:do_populate_sysroot') | 
|  | 680 |  | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 681 | # *.lz should DEPEND on lzip-native for unpacking | 
| Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 682 | elif path.endswith('.lz'): | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 683 | d.appendVarFlag('do_unpack', 'depends', ' lzip-native:do_populate_sysroot') | 
|  | 684 |  | 
|  | 685 | # *.xz should DEPEND on xz-native for unpacking | 
| Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 686 | elif path.endswith('.xz') or path.endswith('.txz'): | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 687 | d.appendVarFlag('do_unpack', 'depends', ' xz-native:do_populate_sysroot') | 
|  | 688 |  | 
|  | 689 | # .zip should DEPEND on unzip-native for unpacking | 
| Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 690 | elif path.endswith('.zip') or path.endswith('.jar'): | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 691 | d.appendVarFlag('do_unpack', 'depends', ' unzip-native:do_populate_sysroot') | 
|  | 692 |  | 
| Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 693 | # Some rpm files may be compressed internally using xz (for example, rpms from Fedora) | 
| Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 694 | elif path.endswith('.rpm'): | 
| Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 695 | d.appendVarFlag('do_unpack', 'depends', ' xz-native:do_populate_sysroot') | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 696 |  | 
| Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 697 | # *.deb should DEPEND on xz-native for unpacking | 
| Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 698 | elif path.endswith('.deb'): | 
| Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 699 | d.appendVarFlag('do_unpack', 'depends', ' xz-native:do_populate_sysroot') | 
|  | 700 |  | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 701 | if needsrcrev: | 
|  | 702 | d.setVar("SRCPV", "${@bb.fetch2.get_srcrev(d)}") | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 703 |  | 
| Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 704 | # Gather all named SRCREVs to add to the sstate hash calculation | 
|  | 705 | # This anonymous python snippet is called multiple times so we | 
|  | 706 | # need to be careful to not double up the appends here and cause | 
|  | 707 | # the base hash to mismatch the task hash | 
|  | 708 | for uri in srcuri.split(): | 
|  | 709 | parm = bb.fetch.decodeurl(uri)[5] | 
|  | 710 | uri_names = parm.get("name", "").split(",") | 
|  | 711 | for uri_name in filter(None, uri_names): | 
|  | 712 | srcrev_name = "SRCREV_{}".format(uri_name) | 
|  | 713 | if srcrev_name not in (d.getVarFlag("do_fetch", "vardeps") or "").split(): | 
|  | 714 | d.appendVarFlag("do_fetch", "vardeps", " {}".format(srcrev_name)) | 
|  | 715 |  | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 716 | set_packagetriplet(d) | 
|  | 717 |  | 
|  | 718 | # 'multimachine' handling | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 719 | mach_arch = d.getVar('MACHINE_ARCH') | 
|  | 720 | pkg_arch = d.getVar('PACKAGE_ARCH') | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 721 |  | 
|  | 722 | if (pkg_arch == mach_arch): | 
|  | 723 | # Already machine specific - nothing further to do | 
|  | 724 | return | 
|  | 725 |  | 
|  | 726 | # | 
|  | 727 | # We always try to scan SRC_URI for urls with machine overrides | 
|  | 728 | # unless the package sets SRC_URI_OVERRIDES_PACKAGE_ARCH=0 | 
|  | 729 | # | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 730 | override = d.getVar('SRC_URI_OVERRIDES_PACKAGE_ARCH') | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 731 | if override != '0': | 
|  | 732 | paths = [] | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 733 | fpaths = (d.getVar('FILESPATH') or '').split(':') | 
|  | 734 | machine = d.getVar('MACHINE') | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 735 | for p in fpaths: | 
|  | 736 | if os.path.basename(p) == machine and os.path.isdir(p): | 
|  | 737 | paths.append(p) | 
|  | 738 |  | 
| Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 739 | if paths: | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 740 | for s in srcuri.split(): | 
|  | 741 | if not s.startswith("file://"): | 
|  | 742 | continue | 
|  | 743 | fetcher = bb.fetch2.Fetch([s], d) | 
|  | 744 | local = fetcher.localpath(s) | 
|  | 745 | for mp in paths: | 
|  | 746 | if local.startswith(mp): | 
|  | 747 | #bb.note("overriding PACKAGE_ARCH from %s to %s for %s" % (pkg_arch, mach_arch, pn)) | 
|  | 748 | d.setVar('PACKAGE_ARCH', "${MACHINE_ARCH}") | 
|  | 749 | return | 
|  | 750 |  | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 751 | packages = d.getVar('PACKAGES').split() | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 752 | for pkg in packages: | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 753 | pkgarch = d.getVar("PACKAGE_ARCH_%s" % pkg) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 754 |  | 
|  | 755 | # We could look for != PACKAGE_ARCH here but how to choose | 
|  | 756 | # if multiple differences are present? | 
|  | 757 | # Look through PACKAGE_ARCHS for the priority order? | 
|  | 758 | if pkgarch and pkgarch == mach_arch: | 
|  | 759 | d.setVar('PACKAGE_ARCH', "${MACHINE_ARCH}") | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 760 | 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 761 | } | 
|  | 762 |  | 
|  | 763 | addtask cleansstate after do_clean | 
|  | 764 | python do_cleansstate() { | 
|  | 765 | sstate_clean_cachefiles(d) | 
|  | 766 | } | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 767 | addtask cleanall after do_cleansstate | 
| Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 768 | do_cleansstate[nostamp] = "1" | 
|  | 769 |  | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 770 | python do_cleanall() { | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 771 | src_uri = (d.getVar('SRC_URI') or "").split() | 
| Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 772 | if not src_uri: | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 773 | return | 
|  | 774 |  | 
|  | 775 | try: | 
|  | 776 | fetcher = bb.fetch2.Fetch(src_uri, d) | 
|  | 777 | fetcher.clean() | 
| Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 778 | except bb.fetch2.BBFetchException as e: | 
|  | 779 | bb.fatal(str(e)) | 
| Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 780 | } | 
|  | 781 | do_cleanall[nostamp] = "1" | 
|  | 782 |  | 
|  | 783 |  | 
|  | 784 | EXPORT_FUNCTIONS do_fetch do_unpack do_configure do_compile do_install do_package |