distro_check: Fix a bug when creating log file
cover distro_check: Fix a bug when creating log file
From: Mei Lei <[email protected]>
Hi Saul,
This patch fix a bug when creating log file, because we have created the log file in check_eventhandler, we need to remove the create log process in save_distro_check_result.
Thanks
Lei
Pull URL: git://git.pokylinux.org/poky-contrib.git
Branch: lmei3/licensecheck
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=lmei3/licensecheck
Thanks,
Mei Lei <[email protected]>
---
Mei Lei (1):
distro_check: Fix a bug in distro_check.py
meta/classes/distrodata.bbclass | 9 +++++++-- meta/lib/oe/distro_check.py | 9 +-------- 2 files changed, 8 insertions(+), 10 deletions(-)
PATCH 1/1 distro_check: Fix a bug in distro_check.py
From: Mei Lei <[email protected]>
distro_check.py: Fix a bug when creating log file, due to we have created the log file in check_eventhandler, we need to remove the log generate process in save_distro_check_result. distrodata.bbclass: Sync with distro_check.py change.
--- meta/classes/distrodata.bbclass | 9 +++++++-- meta/lib/oe/distro_check.py | 9 +-------- 2 files changed, 8 insertions(+), 10 deletions(-)
meta/classes/distrodata.bbclass +7 -2
@@ -644,7 +644,7 @@ python check_eventhandler() { datetime = bb.data.getVar('DATETIME', e.data, 1) """initialize log files.""" import oe.distro_check as dc - logfile = dc.create_log_file(e.data,"distrocheck.csv") + result_file = dc.create_log_file(e.data,"distrocheck.csv") return }
@@ -653,10 +653,15 @@ do_distro_check[nostamp] = "1" python do_distro_check() { """checks if the package is present in other public Linux distros""" import oe.distro_check as dc + import bb + import shutil localdata = bb.data.createCopy(d) bb.data.update_data(localdata) tmpdir = bb.data.getVar('TMPDIR', d, 1) distro_check_dir = os.path.join(tmpdir, "distro_check") + logpath = bb.data.getVar('LOG_DIR', d, 1) + bb.utils.mkdirhier(logpath) + result_file = os.path.join(logpath, "distrocheck.csv") datetime = bb.data.getVar('DATETIME', localdata, 1) dc.update_distro_data(distro_check_dir, datetime)
@@ -664,7 +669,7 @@ python do_distro_check() { result = dc.compare_in_distro_packages_list(distro_check_dir, d) # save the results - dc.save_distro_check_result(result, datetime, d) + dc.save_distro_check_result(result, datetime, result_file, d) } addtask distro_checkall after do_distro_check
meta/lib/oe/distro_check.py +1 -8
@@ -356,7 +356,7 @@ def create_log_file(d, logname): return logfile -def save_distro_check_result(result, datetime, d): +def save_distro_check_result(result, datetime, result_file, d): pn = bb.data.getVar('PN', d, True) logdir = bb.data.getVar('LOG_DIR', d, True) if not logdir:
@@ -364,16 +364,9 @@ def save_distro_check_result(result, datetime, d): return if not os.path.isdir(logdir): os.makedirs(logdir) - result_file = os.path.join(logdir, "distrocheck.%s.csv" % datetime) line = pn for i in result: line = line + "," + i - if not os.path.exists(result_file): - sresult_file = os.path.join(logdir, "distrocheck.csv") - if os.path.exists(sresult_file): - os.remove(sresult_file) - os.system("touch %s" % result_file) - os.symlink(result_file, sresult_file) f = open(result_file, "a") import fcntl fcntl.lockf(f, fcntl.LOCK_EX)
Signature · 1 line
1.6.3.3