summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2020-01-05 14:49:03 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-01-06 23:54:39 +0000
commitb8025e972081b70960ffcbcbe43a7118041556a1 (patch)
treed91c840065c51df3b618c2af4a89a5ff895323af /meta
parent443654351b0e54c76715dd9e5076f32fa6d34592 (diff)
downloadpoky-b8025e972081b70960ffcbcbe43a7118041556a1.tar.gz
sstate: Handle sstate filenames longer than 255 characters
Many filesystems can't cope with filenames longer that 255 characters. Add code to detect this and truncate non-essential elements of the filename to stay within the limit. [YOCTO #13268] (From OE-Core rev: 90cc3d1ed1a12294a2d3ac97c1ba528ab315605d) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/sstate.bbclass19
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
16SSTATE_PKGARCH = "${PACKAGE_ARCH}" 33SSTATE_PKGARCH = "${PACKAGE_ARCH}"
17SSTATE_PKGSPEC = "sstate:${PN}:${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}:${PV}:${PR}:${SSTATE_PKGARCH}:${SSTATE_VERSION}:" 34SSTATE_PKGSPEC = "sstate:${PN}:${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}:${PV}:${PR}:${SSTATE_PKGARCH}:${SSTATE_VERSION}:"