summaryrefslogtreecommitdiffstats
path: root/meta/classes/sstate.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-08-14 14:56:00 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-08-15 09:33:53 +0100
commit5634f2fb1740732056d2c1a22717184ef94405bf (patch)
treed487062c73e6b38f39ae3b7de0a0658736816b7e /meta/classes/sstate.bbclass
parentc7c5f4065c102fde4e11d138fb0b6e25bffe0379 (diff)
downloadopenembedded-core-5634f2fb1740732056d2c1a22717184ef94405bf.tar.gz
sstate: Ensure a given machine only removes things which it created
Currently if you build qemux86 and then generic86, the latter will remove all of the former from deploy and workdir. This is because qemux86 is i586, genericx86 is i686 and the architctures are compatible therefore the sstate 'cleaup' code kicks in. There was a valid reason for this to ensure i586 packages didn't get into an i686 rootfs for example. With the rootfs creation being filtered now, this is no longer necessary. Instead, save out a list of stamps which a give machine has ever seen in a given build and only clean up these things if they're no longer "reachable". In particular this means the autobuilder should no longer spend a load of time deleting files when switching MACHINE, improving build times. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/sstate.bbclass')
-rw-r--r--meta/classes/sstate.bbclass17
1 files changed, 16 insertions, 1 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 9927c76596..cd42db665c 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -1045,6 +1045,16 @@ python sstate_eventhandler2() {
with open(preservestampfile, 'r') as f:
preservestamps = f.readlines()
seen = []
+
+ # The machine index contains all the stamps this machine has ever seen in this build directory.
+ # We should only remove things which this machine once accessed but no longer does.
+ machineindex = set()
+ bb.utils.mkdirhier(d.expand("${SSTATE_MANIFESTS}"))
+ mi = d.expand("${SSTATE_MANIFESTS}/index-machine-${MACHINE}")
+ if os.path.exists(mi):
+ with open(mi, "r") as f:
+ machineindex = set(line.strip() for line in f.readlines())
+
for a in sorted(list(set(d.getVar("SSTATE_ARCHS").split()))):
toremove = []
i = d.expand("${SSTATE_MANIFESTS}/index-" + a)
@@ -1054,7 +1064,7 @@ python sstate_eventhandler2() {
lines = f.readlines()
for l in lines:
(stamp, manifest, workdir) = l.split()
- if stamp not in stamps and stamp not in preservestamps:
+ if stamp not in stamps and stamp not in preservestamps and stamp in machineindex:
toremove.append(l)
if stamp not in seen:
bb.debug(2, "Stamp %s is not reachable, removing related manifests" % stamp)
@@ -1083,6 +1093,11 @@ python sstate_eventhandler2() {
with open(i, "w") as f:
for l in lines:
f.write(l)
+ machineindex |= set(stamps)
+ with open(mi, "w") as f:
+ for l in machineindex:
+ f.write(l + "\n")
+
if preservestamps:
os.remove(preservestampfile)
}