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