mirror of
https://git.yoctoproject.org/poky
synced 2026-09-19 00:49:33 +02:00
DistroData: add eventhandler to correctly setup log file
Signed-off-by: Saul Wold <Saul.Wold@intel.com>
This commit is contained in:
committed by
Richard Purdie
parent
d62ee7eaf2
commit
c52fcafe55
@@ -1,6 +1,27 @@
|
|||||||
|
|
||||||
require conf/distro/include/distro_tracking_fields.inc
|
require conf/distro/include/distro_tracking_fields.inc
|
||||||
|
|
||||||
|
addhandler distro_eventhandler
|
||||||
|
python distro_eventhandler() {
|
||||||
|
from bb.event import Handled, NotHandled
|
||||||
|
# if bb.event.getName(e) == "TaskStarted":
|
||||||
|
|
||||||
|
if bb.event.getName(e) == "BuildStarted":
|
||||||
|
"""initialize log files."""
|
||||||
|
logpath = bb.data.getVar('LOG_DIR', e.data, 1)
|
||||||
|
bb.utils.mkdirhier(logpath)
|
||||||
|
logfile = os.path.join(logpath, "distrodata.%s.csv" % bb.data.getVar('DATETIME', e.data, 1))
|
||||||
|
if not os.path.exists(logfile):
|
||||||
|
slogfile = os.path.join(logpath, "distrodata.csv")
|
||||||
|
if os.path.exists(slogfile):
|
||||||
|
os.remove(slogfile)
|
||||||
|
os.system("touch %s" % logfile)
|
||||||
|
os.symlink(logfile, slogfile)
|
||||||
|
bb.data.setVar('LOG_FILE', logfile, e.data)
|
||||||
|
|
||||||
|
return NotHandled
|
||||||
|
}
|
||||||
|
|
||||||
addtask distrodata_np
|
addtask distrodata_np
|
||||||
do_distrodata_np[nostamp] = "1"
|
do_distrodata_np[nostamp] = "1"
|
||||||
python do_distrodata_np() {
|
python do_distrodata_np() {
|
||||||
@@ -71,16 +92,11 @@ python do_distrodata_np() {
|
|||||||
addtask distrodata
|
addtask distrodata
|
||||||
do_distrodata[nostamp] = "1"
|
do_distrodata[nostamp] = "1"
|
||||||
python do_distrodata() {
|
python do_distrodata() {
|
||||||
"""initialize log files."""
|
|
||||||
logpath = bb.data.getVar('LOG_DIR', d, 1)
|
logpath = bb.data.getVar('LOG_DIR', d, 1)
|
||||||
bb.utils.mkdirhier(logpath)
|
bb.utils.mkdirhier(logpath)
|
||||||
logfile = os.path.join(logpath, "distrodata.%s.csv" % bb.data.getVar('DATETIME', d, 1))
|
logfile = os.path.join(logpath, "distrodata.csv")
|
||||||
if not os.path.exists(logfile):
|
bb.note("LOG_FILE: %s\n" % logfile)
|
||||||
slogfile = os.path.join(logpath, "distrodata.csv")
|
|
||||||
if os.path.exists(slogfile):
|
|
||||||
os.remove(slogfile)
|
|
||||||
os.system("touch %s" % logfile)
|
|
||||||
os.symlink(logfile, slogfile)
|
|
||||||
|
|
||||||
localdata = bb.data.createCopy(d)
|
localdata = bb.data.createCopy(d)
|
||||||
pn = bb.data.getVar("PN", d, True)
|
pn = bb.data.getVar("PN", d, True)
|
||||||
|
|||||||
Reference in New Issue
Block a user