[OE-core] [PATCH 1/1] [RFC/RFT] sstate: Shorten file names in sstate-cache

Paul Barker paul at betafive.co.uk
Fri Jan 11 16:44:38 UTC 2019


With the recent move to using sha256 checksums in sstate, the lengths of
some file names can now exceed the 255 char limit seen in most Linux
filesystems. When this occurs, bitbake crashes as it is unable to create
the sstate archive or sigfile.

To avoid this issue we need to shorten the length of the file names used
in the sstate cache. We can remove the 'sstate:' prefix as these files
already reside in a directory which only contains sstate files. We can
also remove the target triplet (set by the expansion of
${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}) as we also have the
package arch later via the expansion of ${SSTATE_PKGARCH}. And for
simplicity we can replace the expansion of ${PN}, ${PV} and ${PR} with
${PF}.

With the above changes we may still get bitten by packages with
exceptionally long names and/or version strings. To avoid this we limit
the length of the expansions of ${PF} to 100 chars and ${SSTATE_PKGARCH}
to 32 chars. Allowing a further 64 chars for the sha256 hash this leaves
about 50 chars for the task name and extensions (in the worst case)
which should be sufficient.

Signed-off-by: Paul Barker <paul at betafive.co.uk>
---
 meta/classes/sstate.bbclass | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index da0807d6e9..987218afaf 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -8,9 +8,12 @@ def generate_sstatefn(spec, hash, d):
         hash = "INVALID"
     return hash[:2] + "/" + spec + hash
 
+def limit_sstate_frag(frag, limit, d):
+    return frag[:limit]
+
 SSTATE_PKGARCH    = "${PACKAGE_ARCH}"
-SSTATE_PKGSPEC    = "sstate:${PN}:${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}:${PV}:${PR}:${SSTATE_PKGARCH}:${SSTATE_VERSION}:"
-SSTATE_SWSPEC     = "sstate:${PN}::${PV}:${PR}::${SSTATE_VERSION}:"
+SSTATE_PKGSPEC    = "${@limit_sstate_frag(d.getVar('PF'), 100, d)}:${@limit_sstate_frag(d.getVar('SSTATE_PKGARCH'), 32, d)}:${SSTATE_VERSION}:"
+SSTATE_SWSPEC     = "${@limit_sstate_frag(d.getVar('PF'), 100, d)}::${SSTATE_VERSION}:"
 SSTATE_PKGNAME    = "${SSTATE_EXTRAPATH}${@generate_sstatefn(d.getVar('SSTATE_PKGSPEC'), d.getVar('BB_UNIHASH'), d)}"
 SSTATE_PKG        = "${SSTATE_DIR}/${SSTATE_PKGNAME}"
 SSTATE_EXTRAPATH   = ""
-- 
2.17.1



More information about the Openembedded-core mailing list