diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-01-05 14:48:39 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-01-06 23:54:39 +0000 |
| commit | 443654351b0e54c76715dd9e5076f32fa6d34592 (patch) | |
| tree | ae0fac55d8c4b4a4956f0d69df33ee037b7157bf /meta/classes/sstate.bbclass | |
| parent | f3010f76943fc2bcfe73d97e67f211187cf3551a (diff) | |
| download | poky-443654351b0e54c76715dd9e5076f32fa6d34592.tar.gz | |
sstate: Merge file name generation into single function
Move the task handling and extension handling into one common filename
construction function.
(From OE-Core rev: c0c158d38583648a801e959d91371f7b43a98da5)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/sstate.bbclass')
| -rw-r--r-- | meta/classes/sstate.bbclass | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass index 5bd4031e53..71ae090077 100644 --- a/meta/classes/sstate.bbclass +++ b/meta/classes/sstate.bbclass | |||
| @@ -3,15 +3,20 @@ SSTATE_VERSION = "3" | |||
| 3 | SSTATE_MANIFESTS ?= "${TMPDIR}/sstate-control" | 3 | SSTATE_MANIFESTS ?= "${TMPDIR}/sstate-control" |
| 4 | SSTATE_MANFILEPREFIX = "${SSTATE_MANIFESTS}/manifest-${SSTATE_MANMACH}-${PN}" | 4 | SSTATE_MANFILEPREFIX = "${SSTATE_MANIFESTS}/manifest-${SSTATE_MANMACH}-${PN}" |
| 5 | 5 | ||
| 6 | def generate_sstatefn(spec, hash, d): | 6 | def generate_sstatefn(spec, hash, taskname, siginfo, d): |
| 7 | if taskname is None: | ||
| 8 | return "" | ||
| 9 | extension = ".tgz" | ||
| 10 | if siginfo: | ||
| 11 | extension = ".tgz.siginfo" | ||
| 7 | if not hash: | 12 | if not hash: |
| 8 | hash = "INVALID" | 13 | hash = "INVALID" |
| 9 | return hash[:2] + "/" + hash[2:4] + "/" + spec + hash | 14 | return hash[:2] + "/" + hash[2:4] + "/" + spec + hash + "_" + taskname + extension |
| 10 | 15 | ||
| 11 | SSTATE_PKGARCH = "${PACKAGE_ARCH}" | 16 | SSTATE_PKGARCH = "${PACKAGE_ARCH}" |
| 12 | SSTATE_PKGSPEC = "sstate:${PN}:${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}:${PV}:${PR}:${SSTATE_PKGARCH}:${SSTATE_VERSION}:" | 17 | SSTATE_PKGSPEC = "sstate:${PN}:${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}:${PV}:${PR}:${SSTATE_PKGARCH}:${SSTATE_VERSION}:" |
| 13 | SSTATE_SWSPEC = "sstate:${PN}::${PV}:${PR}::${SSTATE_VERSION}:" | 18 | SSTATE_SWSPEC = "sstate:${PN}::${PV}:${PR}::${SSTATE_VERSION}:" |
| 14 | SSTATE_PKGNAME = "${SSTATE_EXTRAPATH}${@generate_sstatefn(d.getVar('SSTATE_PKGSPEC'), d.getVar('BB_UNIHASH'), d)}_${SSTATE_CURRTASK}.tgz" | 19 | SSTATE_PKGNAME = "${SSTATE_EXTRAPATH}${@generate_sstatefn(d.getVar('SSTATE_PKGSPEC'), d.getVar('BB_UNIHASH'), d.getVar('SSTATE_CURRTASK'), False, d)}" |
| 15 | SSTATE_PKG = "${SSTATE_DIR}/${SSTATE_PKGNAME}" | 20 | SSTATE_PKG = "${SSTATE_DIR}/${SSTATE_PKGNAME}" |
| 16 | SSTATE_EXTRAPATH = "" | 21 | SSTATE_EXTRAPATH = "" |
| 17 | SSTATE_EXTRAPATHWILDCARD = "" | 22 | SSTATE_EXTRAPATHWILDCARD = "" |
| @@ -822,9 +827,6 @@ BB_HASHCHECK_FUNCTION = "sstate_checkhashes" | |||
| 822 | def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True, **kwargs): | 827 | def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True, **kwargs): |
| 823 | found = set() | 828 | found = set() |
| 824 | missed = set() | 829 | missed = set() |
| 825 | extension = ".tgz" | ||
| 826 | if siginfo: | ||
| 827 | extension = extension + ".siginfo" | ||
| 828 | 830 | ||
| 829 | def gethash(task): | 831 | def gethash(task): |
| 830 | return sq_data['unihash'][task] | 832 | return sq_data['unihash'][task] |
| @@ -851,7 +853,7 @@ def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True, | |||
| 851 | 853 | ||
| 852 | spec, extrapath, tname = getpathcomponents(tid, d) | 854 | spec, extrapath, tname = getpathcomponents(tid, d) |
| 853 | 855 | ||
| 854 | sstatefile = d.expand("${SSTATE_DIR}/" + extrapath + generate_sstatefn(spec, gethash(tid), d) + "_" + tname + extension) | 856 | sstatefile = d.expand("${SSTATE_DIR}/" + extrapath + generate_sstatefn(spec, gethash(tid), tname, siginfo, d)) |
| 855 | 857 | ||
| 856 | if os.path.exists(sstatefile): | 858 | if os.path.exists(sstatefile): |
| 857 | bb.debug(2, "SState: Found valid sstate file %s" % sstatefile) | 859 | bb.debug(2, "SState: Found valid sstate file %s" % sstatefile) |
| @@ -914,7 +916,7 @@ def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True, | |||
| 914 | if tid in found: | 916 | if tid in found: |
| 915 | continue | 917 | continue |
| 916 | spec, extrapath, tname = getpathcomponents(tid, d) | 918 | spec, extrapath, tname = getpathcomponents(tid, d) |
| 917 | sstatefile = d.expand(extrapath + generate_sstatefn(spec, gethash(tid), d) + "_" + tname + extension) | 919 | sstatefile = d.expand(extrapath + generate_sstatefn(spec, gethash(tid), tname, siginfo, d)) |
| 918 | tasklist.append((tid, sstatefile)) | 920 | tasklist.append((tid, sstatefile)) |
| 919 | 921 | ||
| 920 | if tasklist: | 922 | if tasklist: |
| @@ -944,11 +946,11 @@ def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True, | |||
| 944 | evdata = {'missed': [], 'found': []}; | 946 | evdata = {'missed': [], 'found': []}; |
| 945 | for tid in missed: | 947 | for tid in missed: |
| 946 | spec, extrapath, tname = getpathcomponents(tid, d) | 948 | spec, extrapath, tname = getpathcomponents(tid, d) |
| 947 | sstatefile = d.expand(extrapath + generate_sstatefn(spec, gethash(tid), d) + "_" + tname + ".tgz") | 949 | sstatefile = d.expand(extrapath + generate_sstatefn(spec, gethash(tid), tname, False, d)) |
| 948 | evdata['missed'].append((bb.runqueue.fn_from_tid(tid), bb.runqueue.taskname_from_tid(tid), gethash(tid), sstatefile ) ) | 950 | evdata['missed'].append((bb.runqueue.fn_from_tid(tid), bb.runqueue.taskname_from_tid(tid), gethash(tid), sstatefile ) ) |
| 949 | for tid in found: | 951 | for tid in found: |
| 950 | spec, extrapath, tname = getpathcomponents(tid, d) | 952 | spec, extrapath, tname = getpathcomponents(tid, d) |
| 951 | sstatefile = d.expand(extrapath + generate_sstatefn(spec, gethash(tid), d) + "_" + tname + ".tgz") | 953 | sstatefile = d.expand(extrapath + generate_sstatefn(spec, gethash(tid), tname, False, d)) |
| 952 | evdata['found'].append((bb.runqueue.fn_from_tid(tid), bb.runqueue.taskname_from_tid(tid), gethash(tid), sstatefile ) ) | 954 | evdata['found'].append((bb.runqueue.fn_from_tid(tid), bb.runqueue.taskname_from_tid(tid), gethash(tid), sstatefile ) ) |
| 953 | bb.event.fire(bb.event.MetadataEvent("MissedSstate", evdata), d) | 955 | bb.event.fire(bb.event.MetadataEvent("MissedSstate", evdata), d) |
| 954 | 956 | ||
