[oe-commits] [openembedded-core] 05/05: sstate: Handle sstate filenames longer than 255 characters

git at git.openembedded.org git at git.openembedded.org
Mon Jan 6 00:22:57 UTC 2020


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 0b2249b3bcce31c27ff207fe57801d1ced1fb6da
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Sun Jan 5 14:49:03 2020 +0000

    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]
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/sstate.bbclass | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 71ae090..241dace 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -7,11 +7,28 @@ def generate_sstatefn(spec, hash, taskname, siginfo, d):
     if taskname is None:
        return ""
     extension = ".tgz"
+    # 8 chars reserved for siginfo
+    limit = 254 - 8
     if siginfo:
+        limit = 254
         extension = ".tgz.siginfo"
     if not hash:
         hash = "INVALID"
-    return hash[:2] + "/" + hash[2:4] + "/" + spec + hash + "_" + taskname + extension
+    fn = spec + hash + "_" + taskname + extension
+    # If the filename is too long, attempt to reduce it
+    if len(fn) > limit:
+        components = spec.split(":")
+        # Fields 0,5,6 are mandatory, 1 is most useful, 2,3,4 are just for information
+        # 7 is for the separators
+        avail = (254 - len(hash + "_" + taskname + extension) - len(components[0]) - len(components[1]) - len(components[5]) - len(components[6]) - 7) / 3
+        components[2] = components[2][:avail]
+        components[3] = components[3][:avail]
+        components[4] = components[4][:avail]
+        spec = ":".join(components)
+        fn = spec + hash + "_" + taskname + extension
+        if len(fn) > limit:
+            bb.fatal("Unable to reduce sstate name to less than 255 chararacters")
+    return hash[:2] + "/" + hash[2:4] + "/" + fn
 
 SSTATE_PKGARCH    = "${PACKAGE_ARCH}"
 SSTATE_PKGSPEC    = "sstate:${PN}:${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}:${PV}:${PR}:${SSTATE_PKGARCH}:${SSTATE_VERSION}:"

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list