poky/meta/classes/utility-tasks.bbclass
Richard Purdie 4eea21b7ad classes: Only allow network in existing network accessing code
Use the newly added network task flag against tasks where network
access is expected. This is do_fetch, do_checkuri, do_testimage, do_testsdk
and do_testsdkext.

We can't disable networking in sstate tasks due to sstate downloads and
also so we can report hash equivalence to the server so network access
is enabled in sstate tasks.

Access within build-appliance do_image is also allowed due to the use
of pip, this is a poor example made rather obvious now and needs to be reworked.

Network access anywhere else in any other task isn't allowed.

(From OE-Core rev: 7ce1e88a3ad85bbb925bb9f7167dc0a5fd1c27f4)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-01-12 21:10:24 +00:00

55 lines
1.3 KiB
Plaintext

addtask listtasks
do_listtasks[nostamp] = "1"
python do_listtasks() {
taskdescs = {}
maxlen = 0
for e in d.keys():
if d.getVarFlag(e, 'task'):
maxlen = max(maxlen, len(e))
if e.endswith('_setscene'):
desc = "%s (setscene version)" % (d.getVarFlag(e[:-9], 'doc') or '')
else:
desc = d.getVarFlag(e, 'doc') or ''
taskdescs[e] = desc
tasks = sorted(taskdescs.keys())
for taskname in tasks:
bb.plain("%s %s" % (taskname.ljust(maxlen), taskdescs[taskname]))
}
CLEANFUNCS ?= ""
T:task-clean = "${LOG_DIR}/cleanlogs/${PN}"
addtask clean
do_clean[nostamp] = "1"
python do_clean() {
"""clear the build and temp directories"""
dir = d.expand("${WORKDIR}")
bb.note("Removing " + dir)
oe.path.remove(dir)
dir = "%s.*" % d.getVar('STAMP')
bb.note("Removing " + dir)
oe.path.remove(dir)
for f in (d.getVar('CLEANFUNCS') or '').split():
bb.build.exec_func(f, d)
}
addtask checkuri
do_checkuri[nostamp] = "1"
do_checkuri[network] = "1"
python do_checkuri() {
src_uri = (d.getVar('SRC_URI') or "").split()
if len(src_uri) == 0:
return
try:
fetcher = bb.fetch2.Fetch(src_uri, d)
fetcher.checkstatus()
except bb.fetch2.BBFetchException as e:
bb.fatal(str(e))
}