summaryrefslogtreecommitdiffstats
path: root/meta/classes/sstate.bbclass
diff options
context:
space:
mode:
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() {
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}