[poky] [PATCH 1/1] distro_check: Fix a bug in distro_check.py
Mei Lei
lei.mei at intel.com
Fri May 13 22:55:34 PDT 2011
From: Mei Lei <lei.mei at intel.com>
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.
Signed-off-by: Mei Lei <lei.mei at intel.com>
---
meta/classes/distrodata.bbclass | 9 +++++++--
meta/lib/oe/distro_check.py | 9 +--------
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/meta/classes/distrodata.bbclass b/meta/classes/distrodata.bbclass
index 58a2cf7..b6c2c72 100644
--- a/meta/classes/distrodata.bbclass
+++ b/meta/classes/distrodata.bbclass
@@ -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
diff --git a/meta/lib/oe/distro_check.py b/meta/lib/oe/distro_check.py
index 134e92a..e00215a 100644
--- a/meta/lib/oe/distro_check.py
+++ b/meta/lib/oe/distro_check.py
@@ -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)
--
1.6.3.3
More information about the poky
mailing list