rm_work_and_downloads.bbclass 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. # Author: Patrick Ohly <patrick.ohly@intel.com>
  2. # Copyright: Copyright (C) 2015 Intel Corporation
  3. #
  4. # SPDX-License-Identifier: MIT
  5. # This class is used like rm_work:
  6. # INHERIT += "rm_work_and_downloads"
  7. #
  8. # In addition to removing local build directories of a recipe, it also
  9. # removes the downloaded source. This is achieved by making the DL_DIR
  10. # recipe-specific. While reducing disk usage, it increases network usage (for
  11. # example, compiling the same source for target and host implies downloading
  12. # the source twice).
  13. #
  14. # Because the "do_fetch" task does not get re-run after removing the downloaded
  15. # sources, this class is also not suitable for incremental builds.
  16. #
  17. # Where it works well is in well-connected build environments with limited
  18. # disk space (like TravisCI).
  19. inherit rm_work
  20. # This would ensure that the existing do_rm_work() removes the downloads,
  21. # but does not work because some recipes have a circular dependency between
  22. # WORKDIR and DL_DIR (via ${SRCPV}?).
  23. # DL_DIR = "${WORKDIR}/downloads"
  24. # Instead go up one level and remove ourself.
  25. DL_DIR = "${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}/${PN}/downloads"
  26. do_rm_work:append () {
  27. rm -rf ${DL_DIR}
  28. }