Skip to contentSkip to conversation

sstate.bbclass: Fetch non-existing local .sig files if needed

PATCH In review Tobias Hagelborn 2 participants 2 messages Jan 30, 2023 – Feb 2, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 sstate.bbclass: Fetch non-existing local .sig files if needed

For the case of a global shared state cache and a local sstate cache with a mix of signed and un-signed entries, there is a case where a .sig is missing locally, but may exist in the global sstate cache.

For this case, do not just fail sstate fetch, but rather backfill the .sig file from the global sstate cache.

If this case is detected, re-run the fetch operation to get the global .sig file (if it exists).

---
New in v3:
* Use exists
* Consolidate into previously existing fetch block (with new condition)

 meta/classes-global/sstate.bbclass | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
meta/classes-global/sstate.bbclass +3 -2
index 77e3ea34e1..567de4aba4 100644
@@ -365,8 +365,9 @@ def sstate_installpkg(ss, d):
     d.setVar("SSTATE_CURRTASK", ss['task'])
     sstatefetch = d.getVar('SSTATE_PKGNAME')
     sstatepkg = d.getVar('SSTATE_PKG')
+    verify_sig = bb.utils.to_boolean(d.getVar("SSTATE_VERIFY_SIG"), False)
 
-    if not os.path.exists(sstatepkg):
+    if not os.path.exists(sstatepkg) or (verify_sig and not os.path.exists(sstatepkg + '.sig')):
         pstaging_fetch(sstatefetch, d)
 
     if not os.path.isfile(sstatepkg):
@@ -377,7 +378,7 @@ def sstate_installpkg(ss, d):
 
     d.setVar('SSTATE_INSTDIR', sstateinst)
 
-    if bb.utils.to_boolean(d.getVar("SSTATE_VERIFY_SIG"), False):
+    if verify_sig:
         if not os.path.isfile(sstatepkg + '.sig'):
             bb.warn("No signature file for sstate package %s, skipping acceleration..." % sstatepkg)
             return False
Signature · 1 line
2.30.2
#1 lore raw

Please backport this to Kirkstone and Langdale.

//Peter

Quoted 51 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Tobias Hagelborn
Sent: den 30 januari 2023 15:20
To: [email protected]
Subject: [OE-core] [PATCHv3] sstate.bbclass: Fetch non-existing local .sig files if needed

For the case of a global shared state cache and a local sstate cache with a mix of signed and un-signed entries, there is a case where a .sig is missing locally, but may exist in the global sstate cache.

For this case, do not just fail sstate fetch, but rather backfill the .sig file from the global sstate cache.

If this case is detected, re-run the fetch operation to get the global .sig file (if it exists).

---
New in v3:
* Use exists
* Consolidate into previously existing fetch block (with new condition)

 meta/classes-global/sstate.bbclass | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
meta/classes-global/sstate.bbclass +3 -3
index 77e3ea34e1..567de4aba4 100644
@@ -365,8 +365,9 @@ def sstate_installpkg(ss, d):
     d.setVar("SSTATE_CURRTASK", ss['task'])
     sstatefetch = d.getVar('SSTATE_PKGNAME')
     sstatepkg = d.getVar('SSTATE_PKG')
+    verify_sig = bb.utils.to_boolean(d.getVar("SSTATE_VERIFY_SIG"), False)
 
-    if not os.path.exists(sstatepkg):
+    if not os.path.exists(sstatepkg) or (verify_sig and not os.path.exists(sstatepkg + '.sig')):
         pstaging_fetch(sstatefetch, d)
 
     if not os.path.isfile(sstatepkg):
@@ -377,7 +378,7 @@ def sstate_installpkg(ss, d):
 
     d.setVar('SSTATE_INSTDIR', sstateinst)
 
-    if bb.utils.to_boolean(d.getVar("SSTATE_VERIFY_SIG"), False):
+    if verify_sig:
         if not os.path.isfile(sstatepkg + '.sig'):
             bb.warn("No signature file for sstate package %s, skipping acceleration..." % sstatepkg)
             return False
--

2.30.2