1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7addtask listtasks
8do_listtasks[nostamp] = "1"
9python do_listtasks() {
10    taskdescs = {}
11    maxlen = 0
12    for e in d.keys():
13        if d.getVarFlag(e, 'task'):
14            maxlen = max(maxlen, len(e))
15            if e.endswith('_setscene'):
16                desc = "%s (setscene version)" % (d.getVarFlag(e[:-9], 'doc') or '')
17            else:
18                desc = d.getVarFlag(e, 'doc') or ''
19            taskdescs[e] = desc
20
21    tasks = sorted(taskdescs.keys())
22    for taskname in tasks:
23        bb.plain("%s  %s" % (taskname.ljust(maxlen), taskdescs[taskname]))
24}
25
26CLEANFUNCS ?= ""
27
28T:task-clean = "${LOG_DIR}/cleanlogs/${PN}"
29addtask clean
30do_clean[nostamp] = "1"
31python do_clean() {
32    """clear the build and temp directories"""
33    dir = d.expand("${WORKDIR}")
34    bb.note("Removing " + dir)
35    oe.path.remove(dir)
36
37    dir = "%s.*" % d.getVar('STAMP')
38    bb.note("Removing " + dir)
39    oe.path.remove(dir)
40
41    for f in (d.getVar('CLEANFUNCS') or '').split():
42        bb.build.exec_func(f, d)
43}
44
45addtask checkuri
46do_checkuri[nostamp] = "1"
47do_checkuri[network] = "1"
48python do_checkuri() {
49    src_uri = (d.getVar('SRC_URI') or "").split()
50    if len(src_uri) == 0:
51        return
52
53    try:
54        fetcher = bb.fetch2.Fetch(src_uri, d)
55        fetcher.checkstatus()
56    except bb.fetch2.BBFetchException as e:
57        bb.fatal(str(e))
58}
59
60
61