summaryrefslogtreecommitdiffstats
path: root/meta
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:44:33 +0100
commit8ae762ada1f0d321de88c6d69b75c928ca5a6803 (patch)
tree635620fe9d36041bd27c38ad810ff2b23b794778 /meta
parent26a786f86989ce47eac4eecec3b0798730194b05 (diff)
downloadpoky-8ae762ada1f0d321de88c6d69b75c928ca5a6803.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. (From OE-Core rev: 5634f2fb1740732056d2c1a22717184ef94405bf) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-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() {
1045 with open(preservestampfile, 'r') as f: 1045 with open(preservestampfile, 'r') as f:
1046 preservestamps = f.readlines() 1046 preservestamps = f.readlines()
1047 seen = [] 1047 seen = []
1048
1049 # The machine index contains all the stamps this machine has ever seen in this build directory.
1050 # We should only remove things which this machine once accessed but no longer does.
1051 machineindex = set()
1052 bb.utils.mkdirhier(d.expand("${SSTATE_MANIFESTS}"))
1053 mi = d.expand("${SSTATE_MANIFESTS}/index-machine-${MACHINE}")
1054 if os.path.exists(mi):
1055 with open(mi, "r") as f:
1056 machineindex = set(line.strip() for line in f.readlines())
1057
1048 for a in sorted(list(set(d.getVar("SSTATE_ARCHS").split()))): 1058 for a in sorted(list(set(d.getVar("SSTATE_ARCHS").split()))):
1049 toremove = [] 1059 toremove = []
1050 i = d.expand("${SSTATE_MANIFESTS}/index-" + a) 1060 i = d.expand("${SSTATE_MANIFESTS}/index-" + a)
@@ -1054,7 +1064,7 @@ python sstate_eventhandler2() {
1054 lines = f.readlines() 1064 lines = f.readlines()
1055 for l in lines: 1065 for l in lines:
1056 (stamp, manifest, workdir) = l.split() 1066 (stamp, manifest, workdir) = l.split()
1057 if stamp not in stamps and stamp not in preservestamps: 1067 if stamp not in stamps and stamp not in preservestamps and stamp in machineindex:
1058 toremove.append(l) 1068 toremove.append(l)
1059 if stamp not in seen: 1069 if stamp not in seen:
1060 bb.debug(2, "Stamp %s is not reachable, removing related manifests" % stamp) 1070 bb.debug(2, "Stamp %s is not reachable, removing related manifests" % stamp)
@@ -1083,6 +1093,11 @@ python sstate_eventhandler2() {
1083 with open(i, "w") as f: 1093 with open(i, "w") as f:
1084 for l in lines: 1094 for l in lines:
1085 f.write(l) 1095 f.write(l)
1096 machineindex |= set(stamps)
1097 with open(mi, "w") as f:
1098 for l in machineindex:
1099 f.write(l + "\n")
1100
1086 if preservestamps: 1101 if preservestamps:
1087 os.remove(preservestampfile) 1102 os.remove(preservestampfile)
1088} 1103}