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