buildhistory.bbclass: add ${PN}/cve.log
PATCH 1/1 buildhistory.bbclass: add ${PN}/cve.log
Let archive package cve.logs too
--- meta/classes/buildhistory.bbclass | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
meta/classes/buildhistory.bbclass +24 -0
@@ -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)
Signature · 1 line
2.25.1
Quoted 29 lines · akuster
Let archive package cve.logs too
Signed-off-by Armin Kuster <[email protected]>--- meta/classes/buildhistory.bbclass | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)meta/classes/buildhistory.bbclass +14
-0@@ -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") +
meta/classes/buildhistory.bbclass def write_latest_ptest_result(d, histdir): · line 1093
Quoted 10 lines
meta/classes/buildhistory.bbclass +10
-0+ 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
Quoted 5 lines
Quoted 38 lines · Konrad Weihmann
Quoted 35 lines · akuster
Let archive package cve.logs too
Signed-off-by Armin Kuster <[email protected]>---
meta/classes/buildhistory.bbclass | 24 ++++++++++++++++++++++++1 file changed, 24 insertions(+)meta/classes/buildhistory.bbclass +0
-0@@ -1067,3 +1067,27 @@ def write_latest_ptest_result(d, histdir): bb.error('Failed to run %s!' % cmd)finally:
bb.utils.unlockfile(lock)meta/classes/buildhistory.bbclass +19
-0+ +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")
Quoted 8 lines
Quoted 5 lines
+
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
lockwould be undefined at this line
Good question. I don't know. I just copied that locking from the ptest handler in buildhistory.
-armin
Quoted 6 lines
Quoted 6 lines