diff options
| -rw-r--r-- | meta/classes/sstate.bbclass | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass index 71ae090077..241dace6d9 100644 --- a/meta/classes/sstate.bbclass +++ b/meta/classes/sstate.bbclass | |||
| @@ -7,11 +7,28 @@ def generate_sstatefn(spec, hash, taskname, siginfo, d): | |||
| 7 | if taskname is None: | 7 | if taskname is None: |
| 8 | return "" | 8 | return "" |
| 9 | extension = ".tgz" | 9 | extension = ".tgz" |
| 10 | # 8 chars reserved for siginfo | ||
| 11 | limit = 254 - 8 | ||
| 10 | if siginfo: | 12 | if siginfo: |
| 13 | limit = 254 | ||
| 11 | extension = ".tgz.siginfo" | 14 | extension = ".tgz.siginfo" |
| 12 | if not hash: | 15 | if not hash: |
| 13 | hash = "INVALID" | 16 | hash = "INVALID" |
| 14 | return hash[:2] + "/" + hash[2:4] + "/" + spec + hash + "_" + taskname + extension | 17 | fn = spec + hash + "_" + taskname + extension |
| 18 | # If the filename is too long, attempt to reduce it | ||
| 19 | if len(fn) > limit: | ||
| 20 | components = spec.split(":") | ||
| 21 | # Fields 0,5,6 are mandatory, 1 is most useful, 2,3,4 are just for information | ||
| 22 | # 7 is for the separators | ||
| 23 | avail = (254 - len(hash + "_" + taskname + extension) - len(components[0]) - len(components[1]) - len(components[5]) - len(components[6]) - 7) / 3 | ||
| 24 | components[2] = components[2][:avail] | ||
| 25 | components[3] = components[3][:avail] | ||
| 26 | components[4] = components[4][:avail] | ||
| 27 | spec = ":".join(components) | ||
| 28 | fn = spec + hash + "_" + taskname + extension | ||
| 29 | if len(fn) > limit: | ||
| 30 | bb.fatal("Unable to reduce sstate name to less than 255 chararacters") | ||
| 31 | return hash[:2] + "/" + hash[2:4] + "/" + fn | ||
| 15 | 32 | ||
| 16 | SSTATE_PKGARCH = "${PACKAGE_ARCH}" | 33 | SSTATE_PKGARCH = "${PACKAGE_ARCH}" |
| 17 | SSTATE_PKGSPEC = "sstate:${PN}:${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}:${PV}:${PR}:${SSTATE_PKGARCH}:${SSTATE_VERSION}:" | 34 | SSTATE_PKGSPEC = "sstate:${PN}:${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}:${PV}:${PR}:${SSTATE_PKGARCH}:${SSTATE_VERSION}:" |
