diff options
author | Tudor Florea <tudor.florea@enea.com> | 2015-10-09 22:59:03 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2015-10-09 22:59:03 +0200 |
commit | 972dcfcdbfe75dcfeb777150c136576cf1a71e99 (patch) | |
tree | 97a61cd7e293d7ae9d56ef7ed0f81253365bb026 /meta/classes/rm_work.bbclass | |
download | poky-972dcfcdbfe75dcfeb777150c136576cf1a71e99.tar.gz |
initial commit for Enea Linux 5.0 arm
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta/classes/rm_work.bbclass')
-rw-r--r-- | meta/classes/rm_work.bbclass | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/meta/classes/rm_work.bbclass b/meta/classes/rm_work.bbclass new file mode 100644 index 0000000000..e68d02a783 --- /dev/null +++ b/meta/classes/rm_work.bbclass | |||
@@ -0,0 +1,120 @@ | |||
1 | # | ||
2 | # Removes source after build | ||
3 | # | ||
4 | # To use it add that line to conf/local.conf: | ||
5 | # | ||
6 | # INHERIT += "rm_work" | ||
7 | # | ||
8 | # To inhibit rm_work for some recipes, specify them in RM_WORK_EXCLUDE. | ||
9 | # For example, in conf/local.conf: | ||
10 | # | ||
11 | # RM_WORK_EXCLUDE += "icu-native icu busybox" | ||
12 | # | ||
13 | |||
14 | # Use the completion scheduler by default when rm_work is active | ||
15 | # to try and reduce disk usage | ||
16 | BB_SCHEDULER ?= "completion" | ||
17 | |||
18 | RMWORK_ORIG_TASK := "${BB_DEFAULT_TASK}" | ||
19 | BB_DEFAULT_TASK = "rm_work_all" | ||
20 | |||
21 | do_rm_work () { | ||
22 | # If the recipe name is in the RM_WORK_EXCLUDE, skip the recipe. | ||
23 | for p in ${RM_WORK_EXCLUDE}; do | ||
24 | if [ "$p" = "${PN}" ]; then | ||
25 | bbnote "rm_work: Skipping ${PN} since it is in RM_WORK_EXCLUDE" | ||
26 | exit 0 | ||
27 | fi | ||
28 | done | ||
29 | |||
30 | cd ${WORKDIR} | ||
31 | for dir in * | ||
32 | do | ||
33 | # Retain only logs and other files in temp, safely ignore | ||
34 | # failures of removing pseudo folers on NFS2/3 server. | ||
35 | if [ $dir = 'pseudo' ]; then | ||
36 | rm -rf $dir 2> /dev/null || true | ||
37 | elif [ $dir != 'temp' ]; then | ||
38 | rm -rf $dir | ||
39 | fi | ||
40 | done | ||
41 | |||
42 | # Need to add pseudo back or subsqeuent work in this workdir | ||
43 | # might fail since setscene may not rerun to recreate it | ||
44 | mkdir -p ${WORKDIR}/pseudo/ | ||
45 | |||
46 | # Change normal stamps into setscene stamps as they better reflect the | ||
47 | # fact WORKDIR is now empty | ||
48 | # Also leave noexec stamps since setscene stamps don't cover them | ||
49 | cd `dirname ${STAMP}` | ||
50 | for i in `basename ${STAMP}`* | ||
51 | do | ||
52 | for j in ${SSTATETASKS} | ||
53 | do | ||
54 | case $i in | ||
55 | *do_setscene*) | ||
56 | break | ||
57 | ;; | ||
58 | *sigdata*) | ||
59 | i=dummy | ||
60 | break | ||
61 | ;; | ||
62 | *do_package_write*) | ||
63 | i=dummy | ||
64 | break | ||
65 | ;; | ||
66 | *do_build*) | ||
67 | i=dummy | ||
68 | break | ||
69 | ;; | ||
70 | # We remove do_package entirely, including any | ||
71 | # sstate version since otherwise we'd need to leave 'plaindirs' around | ||
72 | # such as 'packages' and 'packages-split' and these can be large. No end | ||
73 | # of chain tasks depend directly on do_package anymore. | ||
74 | *do_package|*do_package.*|*do_package_setscene.*) | ||
75 | rm -f $i; | ||
76 | i=dummy | ||
77 | break | ||
78 | ;; | ||
79 | *_setscene*) | ||
80 | i=dummy | ||
81 | break | ||
82 | ;; | ||
83 | *$j|*$j.*) | ||
84 | mv $i `echo $i | sed -e "s#${j}#${j}_setscene#"` | ||
85 | i=dummy | ||
86 | break | ||
87 | ;; | ||
88 | esac | ||
89 | done | ||
90 | rm -f $i | ||
91 | done | ||
92 | } | ||
93 | addtask rm_work after do_${RMWORK_ORIG_TASK} | ||
94 | |||
95 | do_rm_work_all () { | ||
96 | : | ||
97 | } | ||
98 | do_rm_work_all[recrdeptask] = "do_rm_work" | ||
99 | addtask rm_work_all after do_rm_work | ||
100 | |||
101 | do_populate_sdk[postfuncs] += "rm_work_populatesdk" | ||
102 | rm_work_populatesdk () { | ||
103 | : | ||
104 | } | ||
105 | rm_work_populatesdk[cleandirs] = "${WORKDIR}/sdk" | ||
106 | |||
107 | do_rootfs[postfuncs] += "rm_work_rootfs" | ||
108 | rm_work_rootfs () { | ||
109 | : | ||
110 | } | ||
111 | rm_work_rootfs[cleandirs] = "${WORKDIR}/rootfs" | ||
112 | |||
113 | python () { | ||
114 | # If the recipe name is in the RM_WORK_EXCLUDE, skip the recipe. | ||
115 | excludes = (d.getVar("RM_WORK_EXCLUDE", True) or "").split() | ||
116 | pn = d.getVar("PN", True) | ||
117 | if pn in excludes: | ||
118 | d.delVarFlag('rm_work_rootfs', 'cleandirs') | ||
119 | d.delVarFlag('rm_work_populatesdk', 'cleandirs') | ||
120 | } | ||