base.bbclass 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # Copyright (C) 2003 Chris Larson
  2. #
  3. # Permission is hereby granted, free of charge, to any person obtaining a
  4. # copy of this software and associated documentation files (the "Software"),
  5. # to deal in the Software without restriction, including without limitation
  6. # the rights to use, copy, modify, merge, publish, distribute, sublicense,
  7. # and/or sell copies of the Software, and to permit persons to whom the
  8. # Software is furnished to do so, subject to the following conditions:
  9. #
  10. # The above copyright notice and this permission notice shall be included
  11. # in all copies or substantial portions of the Software.
  12. #
  13. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  16. # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  17. # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  18. # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  19. # OTHER DEALINGS IN THE SOFTWARE.
  20. die() {
  21. bbfatal "$*"
  22. }
  23. bbnote() {
  24. echo "NOTE:" "$*"
  25. }
  26. bbwarn() {
  27. echo "WARNING:" "$*"
  28. }
  29. bbfatal() {
  30. echo "FATAL:" "$*"
  31. exit 1
  32. }
  33. addtask showdata
  34. do_showdata[nostamp] = "1"
  35. python do_showdata() {
  36. import sys
  37. # emit variables and shell functions
  38. bb.data.emit_env(sys.__stdout__, d, True)
  39. # emit the metadata which isn't valid shell
  40. for e in bb.data.keys(d):
  41. if d.getVarFlag(e, 'python', False):
  42. bb.plain("\npython %s () {\n%s}" % (e, d.getVar(e)))
  43. }
  44. addtask listtasks
  45. do_listtasks[nostamp] = "1"
  46. python do_listtasks() {
  47. import sys
  48. for e in bb.data.keys(d):
  49. if d.getVarFlag(e, 'task', False):
  50. bb.plain("%s" % e)
  51. }
  52. addtask build
  53. do_build[dirs] = "${TOPDIR}"
  54. do_build[nostamp] = "1"
  55. python base_do_build () {
  56. bb.note("The included, default BB base.bbclass does not define a useful default task.")
  57. bb.note("Try running the 'listtasks' task against a .bb to see what tasks are defined.")
  58. }
  59. EXPORT_FUNCTIONS do_clean do_mrproper do_build