blob: 2695a3807fd3d39d7fc773a5d8fdc332bd3e4f1a [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#
Patrick Williams92b42cb2022-09-03 06:53:57 -05004# SPDX-License-Identifier: MIT
Brad Bishop6e60e8b2018-02-01 10:27:11 -05005
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
21inherit 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.
29DL_DIR = "${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}/${PN}/downloads"
Patrick Williams213cb262021-08-07 19:21:33 -050030do_rm_work:append () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050031 rm -rf ${DL_DIR}
32}