On 14.02.21 18:59, akuster wrote:
Let archive package cve.logs too

Signed-off-by: Armin Kuster <[email protected]>
---
  meta/classes/buildhistory.bbclass | 24 ++++++++++++++++++++++++
  1 file changed, 24 insertions(+)

diff --git a/meta/classes/buildhistory.bbclass 
b/meta/classes/buildhistory.bbclass
index 8ed420174e9..a119981d9b7 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -1067,3 +1067,27 @@ def write_latest_ptest_result(d, histdir):
                      bb.error('Failed to run %s!' % cmd)
          finally:
              bb.utils.unlockfile(lock)
+
+do_cve_check[postfuncs] += "write_cve_result"
+do_cve_check[vardepsexclude] += "write_cve_result"
+
+python write_cve_result() {
+    write_latest_cve_result(d, d.getVar('BUILDHISTORY_DIR'))
+}
+
+def write_latest_cve_result(d, histdir):
+    import shutil
+
+    input_file = d.getVar("CVE_CHECK_LOG")
+    pkg = d.getVar("PN")
+
+    output_cve = os.path.join(histdir, 'cve', pkg)
+    if os.path.isfile(input_file):
+        try:
+            # Lock it avoid race issue
+            lock = bb.utils.lockfile(histdir + "/cve.lock")
+            bb.utils.mkdirhier(output_cve)
+            shutil.copyfile(input_file, output_cve+"/cve.log")
+
+        finally:
+            bb.utils.unlockfile(lock)

just theoretically if bb.utils.lockfile raises an exception `lock` would be undefined at this line






-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#148034): 
https://lists.openembedded.org/g/openembedded-core/message/148034
Mute This Topic: https://lists.openembedded.org/mt/80635985/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to