summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2017-01-13 15:52:32 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-20 11:53:48 +0000
commitce84432d983dde8f5616727712ac7231e20c4d1b (patch)
tree1ab80fc8a9c5d0773ad00f8e0f4995175fc4bd5a
parent3ba8917c4d890a1fdd3ffb250fe3ef73557542f5 (diff)
downloadpoky-ce84432d983dde8f5616727712ac7231e20c4d1b.tar.gz
rm_work_and_downloads.bbclass: more aggressively minimize disk usage
rm_work.bbclass never deletes downloaded files, even if they are not going to be needed again during the build. rm_work_and_downloads.bbclass is more aggressive in minimizing the used disk space during a build, but has other disadvantages: - sources required by different recipes need to be fetched once per recipe, not once per build - incremental builds do not work reliably because sources get removed without ensuring that sources gets fetched again That makes rm_work_and_downloads.bbclass useful for one-time builds in a constrained environment (like a CI system), but not for general use. (From OE-Core rev: ca23a07fc6677720508197f2b44573bfd6b52f28) Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/rm_work_and_downloads.bbclass33
1 files changed, 33 insertions, 0 deletions
diff --git a/meta/classes/rm_work_and_downloads.bbclass b/meta/classes/rm_work_and_downloads.bbclass
new file mode 100644
index 0000000000..7c00bea597
--- /dev/null
+++ b/meta/classes/rm_work_and_downloads.bbclass
@@ -0,0 +1,33 @@
1# 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"
31do_rm_work_append () {
32 rm -rf ${DL_DIR}
33}