summaryrefslogtreecommitdiffstats
path: root/meta/classes/sstate.bbclass
diff options
context:
space:
mode:
authorJose Quaresma <quaresma.jose@gmail.com>2021-10-03 22:54:05 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-10-23 17:42:27 +0100
commitd7b24328bf46fe19c5fed0b66ca8d93b0c1e2803 (patch)
tree19863e8e2c95ebdbe9a14afbe8de1f02d1dacb33 /meta/classes/sstate.bbclass
parent43f07bdc9fb399b39f3943010f118e1550e93ee4 (diff)
downloadpoky-d7b24328bf46fe19c5fed0b66ca8d93b0c1e2803.tar.gz
sstate.bbclass: count the files on mirrors using the pre local files
We don't need extra python collections to count the found files on the sstate cache and sstate mirrors. The main found collections provides all the files that were found. Then we only need to store the nunber of files that found on the local sstate cache and the files that found on the sstate cache mirror is derived from that. (From OE-Core rev: 0fe71f31593e87b9188b388860d2ba94bf8266bc) Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/sstate.bbclass')
-rw-r--r--meta/classes/sstate.bbclass11
1 files changed, 4 insertions, 7 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 3c179259e7..5736474f4c 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -912,8 +912,6 @@ BB_HASHCHECK_FUNCTION = "sstate_checkhashes"
912 912
913def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True, **kwargs): 913def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True, **kwargs):
914 found = set() 914 found = set()
915 foundLocal = set()
916 foundNet = set()
917 missed = set() 915 missed = set()
918 916
919 def gethash(task): 917 def gethash(task):
@@ -944,14 +942,13 @@ def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True,
944 sstatefile = d.expand("${SSTATE_DIR}/" + extrapath + generate_sstatefn(spec, gethash(tid), tname, siginfo, d)) 942 sstatefile = d.expand("${SSTATE_DIR}/" + extrapath + generate_sstatefn(spec, gethash(tid), tname, siginfo, d))
945 943
946 if os.path.exists(sstatefile): 944 if os.path.exists(sstatefile):
947 bb.debug(2, "SState: Found valid sstate file %s" % sstatefile)
948 found.add(tid) 945 found.add(tid)
949 foundLocal.add(tid) 946 bb.debug(2, "SState: Found valid sstate file %s" % sstatefile)
950 continue
951 else: 947 else:
952 missed.add(tid) 948 missed.add(tid)
953 bb.debug(2, "SState: Looked for but didn't find file %s" % sstatefile) 949 bb.debug(2, "SState: Looked for but didn't find file %s" % sstatefile)
954 950
951 foundLocal = len(found)
955 mirrors = d.getVar("SSTATE_MIRRORS") 952 mirrors = d.getVar("SSTATE_MIRRORS")
956 if mirrors: 953 if mirrors:
957 # Copy the data object and override DL_DIR and SRC_URI 954 # Copy the data object and override DL_DIR and SRC_URI
@@ -992,7 +989,6 @@ def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True,
992 fetcher.checkstatus() 989 fetcher.checkstatus()
993 bb.debug(2, "SState: Successful fetch test for %s" % srcuri) 990 bb.debug(2, "SState: Successful fetch test for %s" % srcuri)
994 found.add(tid) 991 found.add(tid)
995 foundNet.add(tid)
996 if tid in missed: 992 if tid in missed:
997 missed.remove(tid) 993 missed.remove(tid)
998 except bb.fetch2.FetchError as e: 994 except bb.fetch2.FetchError as e:
@@ -1054,7 +1050,8 @@ def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True,
1054 match = 0 1050 match = 0
1055 if total: 1051 if total:
1056 match = len(found) / total * 100 1052 match = len(found) / total * 100
1057 bb.plain("Sstate summary: Wanted %d Local %d Network %d Missed %d Current %d (%d%% match, %d%% complete)" % (total, len(foundLocal), len(foundNet),len(missed), currentcount, match, complete)) 1053 bb.plain("Sstate summary: Wanted %d Local %d Mirrors %d Missed %d Current %d (%d%% match, %d%% complete)" %
1054 (total, foundLocal, len(found)-foundLocal, len(missed), currentcount, match, complete))
1058 1055
1059 if hasattr(bb.parse.siggen, "checkhashes"): 1056 if hasattr(bb.parse.siggen, "checkhashes"):
1060 bb.parse.siggen.checkhashes(sq_data, missed, found, d) 1057 bb.parse.siggen.checkhashes(sq_data, missed, found, d)