utility-tasks.bbclass 1.3 KB

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