From b41148cda9f0cc292b662a8473f26bc1ee0148f3 Mon Sep 17 00:00:00 2001 From: Mei Lei Date: Mon, 16 May 2011 19:06:21 +0800 Subject: Add a new task checklicense and fix some bugs in distro_check.py distro_check.py: Create a new function called create_log_file to reduce a lot of repeat code in distrodata.bbclass. We needn't to create log file in function save_distro_check_result, because the log file has been generated in check_eventhandler. Another bug is that we maybe access the /tmp/Meego-1.0 before we create this file. Add a judge statement to decide whether we need to create this file firstly. distrodata.bbclass: Add a new task checklicense to collect missing text license information. This can help package-report system to know how many recipes are missing license text. Signed-off-by: Mei Lei --- meta/lib/oe/distro_check.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'meta/lib/oe/distro_check.py') diff --git a/meta/lib/oe/distro_check.py b/meta/lib/oe/distro_check.py index c85d4fb28b..55cdcad461 100644 --- a/meta/lib/oe/distro_check.py +++ b/meta/lib/oe/distro_check.py @@ -73,7 +73,8 @@ def clean_package_list(package_list): def get_latest_released_meego_source_package_list(): "Returns list of all the name os packages in the latest meego distro" - + if not os.path.isfile("/tmp/Meego-1.0"): + os.mknod("/tmp/Meego-1.0") f = open("/tmp/Meego-1.0", "r") package_names = [] for line in f: @@ -341,7 +342,22 @@ def compare_in_distro_packages_list(distro_check_dir, d): bb.note("Matching: %s" % matching_distros) return matching_distros -def save_distro_check_result(result, datetime, d): +def create_log_file(d, logname): + logpath = bb.data.getVar('LOG_DIR', d, True) + bb.utils.mkdirhier(logpath) + logfn, logsuffix = os.path.splitext(logname) + logfile = os.path.join(logpath, "%s.%s%s" % (logfn, bb.data.getVar('DATETIME', d, True), logsuffix)) + if not os.path.exists(logfile): + slogfile = os.path.join(logpath, logname) + if os.path.exists(slogfile): + os.remove(slogfile) + os.system("touch %s" % logfile) + os.symlink(logfile, slogfile) + bb.data.setVar('LOG_FILE', logfile, d) + return logfile + + +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: @@ -349,16 +365,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) -- cgit 1.2.3-korg