1. # meta-test-layer/recipes-example/example/example_0.1.bb:
  2. #
  3. # This file was derived from the 'Hello World!' example recipe in the
  4. # Yocto Project Development Manual.
  5. #
  6. SUMMARY = "Simple helloworld application"
  7. SECTION = "examples"
  8. LICENSE = "MIT"
  9. LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
  10. #SRC_URI = ""
  11. inherit my-test
  12. S = "${WORKDIR}"
  13. do_compile() {
  14. ${CC} helloworld.c -o helloworld
  15. }
  16. do_install() {
  17. install -d ${D}${bindir}
  18. install -m 0755 helloworld ${D}${bindir}
  19. }
  20. #--------------------------------------------------
  21. # meta-test-layer/classes/my-test.bbclass:
  22. # The build works with the following anonymous function:
  23. #python () {
  24. # d.setVar("SRC_URI", "file://helloworld.c")
  25. #}
  26. # But does not work with these tasks, why not?
  27. python do_fix_src_uri () {
  28. d.setVar("SRC_URI", "file://helloworld.c")
  29. }
  30. python do_check_src_uri () {
  31. print d.getVar("SRC_URI")
  32. }
  33. addtask fix_src_uri before do_check_src_uri
  34. addtask check_src_uri after do_fix_src_uri before do_fetch
  35. # --------------------------------------------------------
  36. # build/tmp/work/i586-poky-linux/example/0.1-r0/temp/log.do_check_src_uri
  37. DEBUG: Executing python function do_check_src_uri
  38. DEBUG: Python function do_check_src_uri finished
  39. #----------------------------------------------------------
  40. #build/tmp/work/i586-poky-linux/example/0.1-r0/temp/log.task_order:
  41. do_fix_src_uri (3767): log.do_fix_src_uri.3767
  42. do_check_src_uri (3768): log.do_check_src_uri.3768
  43. do_fetch (3769): log.do_fetch.3769
  44. do_unpack (3770): log.do_unpack.3770
  45. do_patch (3771): log.do_patch.3771
  46. do_configure (3773): log.do_configure.3773
  47. do_populate_lic (3774): log.do_populate_lic.3774
  48. do_compile (3795): log.do_compile.3795